summaryrefslogtreecommitdiff
path: root/spec/services/projects/update_service_spec.rb
diff options
context:
space:
mode:
authorBrett Walker <bwalker@gitlab.com>2019-08-15 17:37:36 +0000
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2019-08-15 17:37:36 +0000
commit3489dc3d7277bf478f68e1b3e0353b702f652acc (patch)
tree896dc6ef08d8347e992365594ce7c4b0d49e6ee4 /spec/services/projects/update_service_spec.rb
parent23754943a7ec119f123694a93c79fc07c32b7ba5 (diff)
downloadgitlab-ce-3489dc3d7277bf478f68e1b3e0353b702f652acc.tar.gz
Allow disabling group/project email notifications
- Adds UI to configure in group and project settings - Removes notification configuration for users when disabled at group or project level
Diffstat (limited to 'spec/services/projects/update_service_spec.rb')
-rw-r--r--spec/services/projects/update_service_spec.rb22
1 files changed, 20 insertions, 2 deletions
diff --git a/spec/services/projects/update_service_spec.rb b/spec/services/projects/update_service_spec.rb
index 82010dd283c..31bd0f0f836 100644
--- a/spec/services/projects/update_service_spec.rb
+++ b/spec/services/projects/update_service_spec.rb
@@ -369,9 +369,28 @@ describe Projects::UpdateService do
end
end
+ context 'when updating #emails_disabled' do
+ it 'updates the attribute for the project owner' do
+ expect { update_project(project, user, emails_disabled: true) }
+ .to change { project.emails_disabled }
+ .to(true)
+ end
+
+ it 'does not update when not project owner' do
+ maintainer = create(:user)
+ project.add_user(maintainer, :maintainer)
+
+ expect { update_project(project, maintainer, emails_disabled: true) }
+ .not_to change { project.emails_disabled }
+ end
+ end
+
context 'with external authorization enabled' do
before do
enable_external_authorization_service_check
+
+ allow(::Gitlab::ExternalAuthorization)
+ .to receive(:access_allowed?).with(user, 'default_label', project.full_path).and_call_original
end
it 'does not save the project with an error if the service denies access' do
@@ -402,8 +421,7 @@ describe Projects::UpdateService do
end
it 'does not check the label when it does not change' do
- expect(::Gitlab::ExternalAuthorization)
- .not_to receive(:access_allowed?)
+ expect(::Gitlab::ExternalAuthorization).to receive(:access_allowed?).once
update_project(project, user, { name: 'New name' })
end