Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOswaldo Ferreira <oswaldo@gitlab.com>2019-04-24 21:17:46 +0300
committerOswaldo Ferreira <oswaldo@gitlab.com>2019-04-25 19:06:06 +0300
commit8f59ea33e7d3dceb63bc5953a5b27d5968536287 (patch)
tree3475f7fe585faa0b5149a566e0596846d7fe9279 /spec/support/protected_branch_helpers.rb
parentc719bc4966bb5eb402ef4b8c03b869eccc430c6d (diff)
Extract EE specific tests for protected branches/tags
We have the spec files containing EE specific code for spec/features/protected_branches_spec.rb and spec/features/protected_tags_spec.rb. This commit deletes / extracts the CE part of it.
Diffstat (limited to 'spec/support/protected_branch_helpers.rb')
-rw-r--r--spec/support/protected_branch_helpers.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/support/protected_branch_helpers.rb b/spec/support/protected_branch_helpers.rb
new file mode 100644
index 00000000000..ede16d1c1e2
--- /dev/null
+++ b/spec/support/protected_branch_helpers.rb
@@ -0,0 +1,30 @@
+# frozen_string_literal: true
+
+module ProtectedBranchHelpers
+ def set_allowed_to(operation, option = 'Maintainers', form: '.js-new-protected-branch')
+ within form do
+ select_elem = find(".js-allowed-to-#{operation}")
+ select_elem.click
+
+ wait_for_requests
+
+ within('.dropdown-content') do
+ Array(option).each { |opt| click_on(opt) }
+ end
+
+ # Enhanced select is used in EE, therefore an extra click is needed.
+ select_elem.click if select_elem['aria-expanded'] == 'true'
+ end
+ end
+
+ def set_protected_branch_name(branch_name)
+ find('.js-protected-branch-select').click
+ find('.dropdown-input-field').set(branch_name)
+ click_on("Create wildcard #{branch_name}")
+ end
+
+ def set_defaults
+ set_allowed_to('merge')
+ set_allowed_to('push')
+ end
+end