diff options
Diffstat (limited to 'spec/features')
5 files changed, 61 insertions, 0 deletions
diff --git a/spec/features/groups/show_spec.rb b/spec/features/groups/show_spec.rb index 942a9889488..bcaed2a5f18 100644 --- a/spec/features/groups/show_spec.rb +++ b/spec/features/groups/show_spec.rb @@ -161,4 +161,27 @@ describe 'Group show page' do expect(find('.group-row:nth-child(3) .namespace-title > a')).to have_content(project3.title) end end + + context 'notification button', :js do + let(:maintainer) { create(:user) } + let!(:project) { create(:project, namespace: group) } + + before do + group.add_maintainer(maintainer) + sign_in(maintainer) + end + + it 'is enabled by default' do + visit path + + expect(page).to have_selector('.notifications-btn:not(.disabled)', visible: true) + end + + it 'is disabled if emails are disabled' do + group.update_attribute(:emails_disabled, true) + visit path + + expect(page).to have_selector('.notifications-btn.disabled', visible: true) + end + end end diff --git a/spec/features/issues/user_toggles_subscription_spec.rb b/spec/features/issues/user_toggles_subscription_spec.rb index 7a721adc8dd..165d41950da 100644 --- a/spec/features/issues/user_toggles_subscription_spec.rb +++ b/spec/features/issues/user_toggles_subscription_spec.rb @@ -27,4 +27,14 @@ describe "User toggles subscription", :js do # Check we're unsubscribed. expect(subscription_button).to have_css("button:not(.is-checked)") end + + context 'when project emails are disabled' do + let(:project) { create(:project_empty_repo, :public, emails_disabled: true) } + + it 'is disabled' do + expect(page).to have_content('Notifications have been disabled by the project or group owner') + expect(page).to have_selector('.js-emails-disabled', visible: true) + expect(page).not_to have_selector('.js-issuable-subscribe-button') + end + end end diff --git a/spec/features/profiles/user_visits_notifications_tab_spec.rb b/spec/features/profiles/user_visits_notifications_tab_spec.rb index 1472cc882a7..d788c0574e2 100644 --- a/spec/features/profiles/user_visits_notifications_tab_spec.rb +++ b/spec/features/profiles/user_visits_notifications_tab_spec.rb @@ -20,4 +20,12 @@ describe 'User visits the notifications tab', :js do expect(page).to have_selector('#notifications-button', text: 'On mention') end + + context 'when project emails are disabled' do + let(:project) { create(:project, emails_disabled: true) } + + it 'notification button is disabled' do + expect(page).to have_selector('.notifications-btn.disabled', visible: true) + end + end end diff --git a/spec/features/projects/settings/visibility_settings_spec.rb b/spec/features/projects/settings/visibility_settings_spec.rb index 46fd676954d..0e757e647a0 100644 --- a/spec/features/projects/settings/visibility_settings_spec.rb +++ b/spec/features/projects/settings/visibility_settings_spec.rb @@ -59,6 +59,12 @@ describe 'Projects > Settings > Visibility settings', :js do end end end + + context 'disable email notifications' do + it 'is visible' do + expect(page).to have_selector('.js-emails-disabled', visible: true) + end + end end context 'as maintainer' do @@ -76,5 +82,11 @@ describe 'Projects > Settings > Visibility settings', :js do expect(visibility_select_container).to have_selector 'select[name="project[visibility_level]"]:disabled' expect(visibility_select_container).to have_content 'The project can be accessed by anyone, regardless of authentication.' end + + context 'disable email notifications' do + it 'is not available' do + expect(page).not_to have_selector('.js-emails-disabled', visible: true) + end + end end end diff --git a/spec/features/projects/show/user_manages_notifications_spec.rb b/spec/features/projects/show/user_manages_notifications_spec.rb index 5e9c98428cf..851a09cf28a 100644 --- a/spec/features/projects/show/user_manages_notifications_spec.rb +++ b/spec/features/projects/show/user_manages_notifications_spec.rb @@ -65,4 +65,12 @@ describe 'Projects > Show > User manages notifications', :js do end end end + + context 'when project emails are disabled' do + let(:project) { create(:project, :public, :repository, emails_disabled: true) } + + it 'is disabled' do + expect(page).to have_selector('.notifications-btn.disabled', visible: true) + end + end end |