Commit e827c619 authored by Brett Walker's avatar Brett Walker Committed by Paul Slaughter

Add additional spec for emails_disabled

in project/group settings
parent 6464d437
...@@ -19,6 +19,7 @@ describe 'Edit group settings' do ...@@ -19,6 +19,7 @@ describe 'Edit group settings' do
it 'the group is accessible via the new path' do it 'the group is accessible via the new path' do
update_path(new_group_path) update_path(new_group_path)
visit new_group_full_path visit new_group_full_path
expect(current_path).to eq(new_group_full_path) expect(current_path).to eq(new_group_full_path)
expect(find('h1.home-panel-title')).to have_content(group.name) expect(find('h1.home-panel-title')).to have_content(group.name)
end end
...@@ -26,6 +27,7 @@ describe 'Edit group settings' do ...@@ -26,6 +27,7 @@ describe 'Edit group settings' do
it 'the old group path redirects to the new path' do it 'the old group path redirects to the new path' do
update_path(new_group_path) update_path(new_group_path)
visit old_group_full_path visit old_group_full_path
expect(current_path).to eq(new_group_full_path) expect(current_path).to eq(new_group_full_path)
expect(find('h1.home-panel-title')).to have_content(group.name) expect(find('h1.home-panel-title')).to have_content(group.name)
end end
...@@ -38,6 +40,7 @@ describe 'Edit group settings' do ...@@ -38,6 +40,7 @@ describe 'Edit group settings' do
it 'the subgroup is accessible via the new path' do it 'the subgroup is accessible via the new path' do
update_path(new_group_path) update_path(new_group_path)
visit new_subgroup_full_path visit new_subgroup_full_path
expect(current_path).to eq(new_subgroup_full_path) expect(current_path).to eq(new_subgroup_full_path)
expect(find('h1.home-panel-title')).to have_content(subgroup.name) expect(find('h1.home-panel-title')).to have_content(subgroup.name)
end end
...@@ -45,6 +48,7 @@ describe 'Edit group settings' do ...@@ -45,6 +48,7 @@ describe 'Edit group settings' do
it 'the old subgroup path redirects to the new path' do it 'the old subgroup path redirects to the new path' do
update_path(new_group_path) update_path(new_group_path)
visit old_subgroup_full_path visit old_subgroup_full_path
expect(current_path).to eq(new_subgroup_full_path) expect(current_path).to eq(new_subgroup_full_path)
expect(find('h1.home-panel-title')).to have_content(subgroup.name) expect(find('h1.home-panel-title')).to have_content(subgroup.name)
end end
...@@ -66,6 +70,7 @@ describe 'Edit group settings' do ...@@ -66,6 +70,7 @@ describe 'Edit group settings' do
it 'the project is accessible via the new path' do it 'the project is accessible via the new path' do
update_path(new_group_path) update_path(new_group_path)
visit new_project_full_path visit new_project_full_path
expect(current_path).to eq(new_project_full_path) expect(current_path).to eq(new_project_full_path)
expect(find('.breadcrumbs')).to have_content(project.path) expect(find('.breadcrumbs')).to have_content(project.path)
end end
...@@ -73,6 +78,7 @@ describe 'Edit group settings' do ...@@ -73,6 +78,7 @@ describe 'Edit group settings' do
it 'the old project path redirects to the new path' do it 'the old project path redirects to the new path' do
update_path(new_group_path) update_path(new_group_path)
visit old_project_full_path visit old_project_full_path
expect(current_path).to eq(new_project_full_path) expect(current_path).to eq(new_project_full_path)
expect(find('.breadcrumbs')).to have_content(project.path) expect(find('.breadcrumbs')).to have_content(project.path)
end end
...@@ -101,7 +107,7 @@ describe 'Edit group settings' do ...@@ -101,7 +107,7 @@ describe 'Edit group settings' do
attach_file(:group_avatar, Rails.root.join('spec', 'fixtures', 'banana_sample.gif')) 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 end
it 'uploads new group avatar' do it 'uploads new group avatar' do
...@@ -132,6 +138,21 @@ describe 'Edit group settings' do ...@@ -132,6 +138,21 @@ describe 'Edit group settings' do
end end
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) def update_path(new_group_path)
visit edit_group_path(group) visit edit_group_path(group)
...@@ -141,9 +162,20 @@ describe 'Edit group settings' do ...@@ -141,9 +162,20 @@ describe 'Edit group settings' do
end end
end end
def save_group def save_general_group
page.within('.gs-general') do page.within('.gs-general') do
click_button 'Save changes' click_button 'Save changes'
end end
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 end
...@@ -64,6 +64,12 @@ describe 'Projects > Settings > Visibility settings', :js do ...@@ -64,6 +64,12 @@ describe 'Projects > Settings > Visibility settings', :js do
it 'is visible' do it 'is visible' do
expect(page).to have_selector('.js-emails-disabled', visible: true) expect(page).to have_selector('.js-emails-disabled', visible: true)
end 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
end end
...@@ -89,4 +95,16 @@ describe 'Projects > Settings > Visibility settings', :js do ...@@ -89,4 +95,16 @@ describe 'Projects > Settings > Visibility settings', :js do
end end
end 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 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