summaryrefslogtreecommitdiff
path: root/spec/features/protected_branches_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/features/protected_branches_spec.rb')
-rw-r--r--spec/features/protected_branches_spec.rb47
1 files changed, 20 insertions, 27 deletions
diff --git a/spec/features/protected_branches_spec.rb b/spec/features/protected_branches_spec.rb
index 0c28a853b54..39bd4af6cd0 100644
--- a/spec/features/protected_branches_spec.rb
+++ b/spec/features/protected_branches_spec.rb
@@ -60,33 +60,6 @@ feature 'Protected Branches', :js do
expect(page).to have_content('No branches to show')
end
end
-
- describe "Saved defaults" do
- it "keeps the allowed to merge and push dropdowns defaults based on the previous selection" do
- visit project_protected_branches_path(project)
- form = '.js-new-protected-branch'
-
- within form do
- find(".js-allowed-to-merge").click
- wait_for_requests
- click_link 'No one'
- find(".js-allowed-to-push").click
- wait_for_requests
- click_link 'Developers + Masters'
- end
-
- visit project_protected_branches_path(project)
-
- within form do
- page.within(".js-allowed-to-merge") do
- expect(page.find(".dropdown-toggle-text")).to have_content("No one")
- end
- page.within(".js-allowed-to-push") do
- expect(page.find(".dropdown-toggle-text")).to have_content("Developers + Masters")
- end
- end
- end
- end
end
context 'logged in as admin' do
@@ -97,6 +70,7 @@ feature 'Protected Branches', :js do
describe "explicit protected branches" do
it "allows creating explicit protected branches" do
visit project_protected_branches_path(project)
+ set_defaults
set_protected_branch_name('some-branch')
click_on "Protect"
@@ -110,6 +84,7 @@ feature 'Protected Branches', :js do
project.repository.add_branch(admin, 'some-branch', commit.id)
visit project_protected_branches_path(project)
+ set_defaults
set_protected_branch_name('some-branch')
click_on "Protect"
@@ -118,6 +93,7 @@ feature 'Protected Branches', :js do
it "displays an error message if the named branch does not exist" do
visit project_protected_branches_path(project)
+ set_defaults
set_protected_branch_name('some-branch')
click_on "Protect"
@@ -128,6 +104,7 @@ feature 'Protected Branches', :js do
describe "wildcard protected branches" do
it "allows creating protected branches with a wildcard" do
visit project_protected_branches_path(project)
+ set_defaults
set_protected_branch_name('*-stable')
click_on "Protect"
@@ -141,6 +118,7 @@ feature 'Protected Branches', :js do
project.repository.add_branch(admin, 'staging-stable', 'master')
visit project_protected_branches_path(project)
+ set_defaults
set_protected_branch_name('*-stable')
click_on "Protect"
@@ -157,6 +135,7 @@ feature 'Protected Branches', :js do
visit project_protected_branches_path(project)
set_protected_branch_name('*-stable')
+ set_defaults
click_on "Protect"
visit project_protected_branches_path(project)
@@ -180,4 +159,18 @@ feature 'Protected Branches', :js do
find(".dropdown-input-field").set(branch_name)
click_on("Create wildcard #{branch_name}")
end
+
+ def set_defaults
+ find(".js-allowed-to-merge").click
+ within('.qa-allowed-to-merge-dropdown') do
+ expect(first("li")).to have_content("Roles")
+ find(:link, 'No one').click
+ end
+
+ find(".js-allowed-to-push").click
+ within('.qa-allowed-to-push-dropdown') do
+ expect(first("li")).to have_content("Roles")
+ find(:link, 'No one').click
+ end
+ end
end