Commit beba1a6f authored by Ruben Davila's avatar Ruben Davila

Fix broken specs and UI for protected branches.

parent 6cbf6dd1
...@@ -24,7 +24,8 @@ ...@@ -24,7 +24,8 @@
.col-md-10 .col-md-10
.merge_access_levels-container .merge_access_levels-container
= dropdown_tag('Select', = dropdown_tag('Select',
options: { toggle_class: 'js-allowed-to-merge wide', options: { toggle_class: 'js-allowed-to-merge js-multiselect wide',
dropdown_class: 'dropdown-menu-user dropdown-menu-selectable',
data: { field_name: 'protected_branch[merge_access_levels_attributes][0][access_level]', input_id: 'merge_access_levels_attributes' }}) data: { field_name: 'protected_branch[merge_access_levels_attributes][0][access_level]', input_id: 'merge_access_levels_attributes' }})
.form-group .form-group
%label.col-md-2.text-right{ for: 'push_access_levels_attributes' } %label.col-md-2.text-right{ for: 'push_access_levels_attributes' }
...@@ -32,7 +33,8 @@ ...@@ -32,7 +33,8 @@
.col-md-10 .col-md-10
.push_access_levels-container .push_access_levels-container
= dropdown_tag('Select', = dropdown_tag('Select',
options: { toggle_class: 'js-allowed-to-push wide', options: { toggle_class: 'js-allowed-to-push js-multiselect wide',
dropdown_class: 'dropdown-menu-user dropdown-menu-selectable',
data: { field_name: 'protected_branch[push_access_levels_attributes][0][access_level]', input_id: 'push_access_levels_attributes' }}) data: { field_name: 'protected_branch[push_access_levels_attributes][0][access_level]', input_id: 'push_access_levels_attributes' }})
.panel-footer .panel-footer
......
...@@ -9,10 +9,10 @@ RSpec.shared_examples "protected branches > access control > EE" do ...@@ -9,10 +9,10 @@ RSpec.shared_examples "protected branches > access control > EE" do
roles = access_level_class.human_access_levels roles = access_level_class.human_access_levels
visit namespace_project_protected_branches_path(project.namespace, project) visit namespace_project_protected_branches_path(project.namespace, project)
set_protected_branch_name('master')
users.each { |user| set_allowed_to(git_operation, user.name) } set_protected_branch_name('master')
roles.each { |(_, access_type_name)| set_allowed_to(git_operation, access_type_name) } set_allowed_to(git_operation, users.map(&:name))
set_allowed_to(git_operation, roles.values)
set_allowed_to(other_git_operation) set_allowed_to(other_git_operation)
click_on "Protect" click_on "Protect"
...@@ -35,8 +35,8 @@ RSpec.shared_examples "protected branches > access control > EE" do ...@@ -35,8 +35,8 @@ RSpec.shared_examples "protected branches > access control > EE" do
click_on "Protect" click_on "Protect"
within(".js-protected-branch-edit-form") do within(".js-protected-branch-edit-form") do
users.each { |user| set_allowed_to(git_operation, user.name) } set_allowed_to(git_operation, users.map(&:name))
roles.each { |(_, access_type_name)| set_allowed_to(git_operation, access_type_name) } set_allowed_to(git_operation, roles.values)
end end
wait_for_ajax wait_for_ajax
......
...@@ -12,7 +12,9 @@ feature 'Projected Branches', feature: true, js: true do ...@@ -12,7 +12,9 @@ feature 'Projected Branches', feature: true, js: true do
def set_allowed_to(operation, option = 'Masters') def set_allowed_to(operation, option = 'Masters')
find(".js-allowed-to-#{operation}").click find(".js-allowed-to-#{operation}").click
wait_for_ajax wait_for_ajax
click_on option
Array(option).each { |opt| click_on(opt) }
find(".js-allowed-to-#{operation}").click # needed to submit form in some cases find(".js-allowed-to-#{operation}").click # needed to submit form in some cases
end end
......
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