Commit 4c28d626 authored by Timothy Andrew's avatar Timothy Andrew

Don't select an access level if already selected.

1. This is in regard to the protected branches feature spec.

2. For example, if "Masters" is already selected, don't re-select
   "Masters" during the spec.

3. This is due to a bug in the frontend implementation, where selecting
   an already-selected access level _deselects_ it, which is something
   we don't need. I'll create a separate issue for this.

4. This hasn't turned up before, because we were manually creating
   missing access levels prior to e805a647. Now, we just use nested
   attributes, and missing access levels fail validation.
parent e805a647
...@@ -93,9 +93,13 @@ feature 'Projected Branches', feature: true, js: true do ...@@ -93,9 +93,13 @@ feature 'Projected Branches', feature: true, js: true do
visit namespace_project_protected_branches_path(project.namespace, project) visit namespace_project_protected_branches_path(project.namespace, project)
set_protected_branch_name('master') set_protected_branch_name('master')
within('.new_protected_branch') do within('.new_protected_branch') do
find(".js-allowed-to-push").click allowed_to_push_button = find(".js-allowed-to-push")
unless allowed_to_push_button.text == access_type_name
allowed_to_push_button.click
within(".dropdown.open .dropdown-menu") { click_on access_type_name } within(".dropdown.open .dropdown-menu") { click_on access_type_name }
end end
end
click_on "Protect" click_on "Protect"
expect(ProtectedBranch.count).to eq(1) expect(ProtectedBranch.count).to eq(1)
...@@ -124,9 +128,13 @@ feature 'Projected Branches', feature: true, js: true do ...@@ -124,9 +128,13 @@ feature 'Projected Branches', feature: true, js: true do
visit namespace_project_protected_branches_path(project.namespace, project) visit namespace_project_protected_branches_path(project.namespace, project)
set_protected_branch_name('master') set_protected_branch_name('master')
within('.new_protected_branch') do within('.new_protected_branch') do
find(".js-allowed-to-merge").click allowed_to_merge_button = find(".js-allowed-to-merge")
unless allowed_to_merge_button.text == access_type_name
allowed_to_merge_button.click
within(".dropdown.open .dropdown-menu") { click_on access_type_name } within(".dropdown.open .dropdown-menu") { click_on access_type_name }
end end
end
click_on "Protect" click_on "Protect"
expect(ProtectedBranch.count).to eq(1) expect(ProtectedBranch.count).to eq(1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment