diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-04 15:07:12 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-04 15:07:12 +0300 |
commit | 98420be3dddf5a093c39d96a8ca109aa21d0eaf8 (patch) | |
tree | 694cbe805e82d5383dc30c462f5efb60e55ccebe /spec/features | |
parent | c4038d4bdff93b260cbdcd69f9a6c0b07a849457 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features')
-rw-r--r-- | spec/features/groups/group_settings_spec.rb | 36 | ||||
-rw-r--r-- | spec/features/projects/settings/visibility_settings_spec.rb | 18 |
2 files changed, 52 insertions, 2 deletions
diff --git a/spec/features/groups/group_settings_spec.rb b/spec/features/groups/group_settings_spec.rb index 41ecd21a386..d686e0ed9d2 100644 --- a/spec/features/groups/group_settings_spec.rb +++ b/spec/features/groups/group_settings_spec.rb @@ -19,6 +19,7 @@ describe 'Edit group settings' do it 'the group is accessible via the new path' do update_path(new_group_path) visit new_group_full_path + expect(current_path).to eq(new_group_full_path) expect(find('h1.home-panel-title')).to have_content(group.name) end @@ -26,6 +27,7 @@ describe 'Edit group settings' do it 'the old group path redirects to the new path' do update_path(new_group_path) visit old_group_full_path + expect(current_path).to eq(new_group_full_path) expect(find('h1.home-panel-title')).to have_content(group.name) end @@ -38,6 +40,7 @@ describe 'Edit group settings' do it 'the subgroup is accessible via the new path' do update_path(new_group_path) visit new_subgroup_full_path + expect(current_path).to eq(new_subgroup_full_path) expect(find('h1.home-panel-title')).to have_content(subgroup.name) end @@ -45,6 +48,7 @@ describe 'Edit group settings' do it 'the old subgroup path redirects to the new path' do update_path(new_group_path) visit old_subgroup_full_path + expect(current_path).to eq(new_subgroup_full_path) expect(find('h1.home-panel-title')).to have_content(subgroup.name) end @@ -66,6 +70,7 @@ describe 'Edit group settings' do it 'the project is accessible via the new path' do update_path(new_group_path) visit new_project_full_path + expect(current_path).to eq(new_project_full_path) expect(find('.breadcrumbs')).to have_content(project.path) end @@ -73,6 +78,7 @@ describe 'Edit group settings' do it 'the old project path redirects to the new path' do update_path(new_group_path) visit old_project_full_path + expect(current_path).to eq(new_project_full_path) expect(find('.breadcrumbs')).to have_content(project.path) end @@ -101,7 +107,7 @@ describe 'Edit group settings' do attach_file(:group_avatar, Rails.root.join('spec', 'fixtures', 'banana_sample.gif')) - expect { save_group }.to change { group.reload.avatar? }.to(true) + expect { save_general_group }.to change { group.reload.avatar? }.to(true) end it 'uploads new group avatar' do @@ -132,6 +138,21 @@ describe 'Edit group settings' do end end + context 'disable email notifications' do + it 'is visible' do + visit edit_group_path(group) + + expect(page).to have_selector('#group_emails_disabled', visible: true) + end + + it 'accepts the changed state' do + visit edit_group_path(group) + check 'group_emails_disabled' + + expect { save_permissions_group }.to change { updated_emails_disabled? }.to(true) + end + end + def update_path(new_group_path) visit edit_group_path(group) @@ -141,9 +162,20 @@ describe 'Edit group settings' do end end - def save_group + def save_general_group page.within('.gs-general') do click_button 'Save changes' end end + + def save_permissions_group + page.within('.gs-permissions') do + click_button 'Save changes' + end + end + + def updated_emails_disabled? + group.reload.clear_memoization(:emails_disabled) + group.emails_disabled? + end end diff --git a/spec/features/projects/settings/visibility_settings_spec.rb b/spec/features/projects/settings/visibility_settings_spec.rb index 0e757e647a0..a2b36874aea 100644 --- a/spec/features/projects/settings/visibility_settings_spec.rb +++ b/spec/features/projects/settings/visibility_settings_spec.rb @@ -64,6 +64,12 @@ describe 'Projects > Settings > Visibility settings', :js do it 'is visible' do expect(page).to have_selector('.js-emails-disabled', visible: true) end + + it 'accepts the changed state' do + find('.js-emails-disabled input[type="checkbox"]').click + + expect { save_permissions_group }.to change { updated_emails_disabled? }.to(true) + end end end @@ -89,4 +95,16 @@ describe 'Projects > Settings > Visibility settings', :js do end end end + + def save_permissions_group + page.within('.sharing-permissions') do + click_button 'Save changes' + wait_for_requests + end + end + + def updated_emails_disabled? + project.reload.clear_memoization(:emails_disabled) + project.emails_disabled? + end end |