Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-07-17 21:09:20 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-07-17 21:09:20 +0300
commitec72da1833d94bb1556af94193ccf2a93c9cb939 (patch)
tree6227669a11aaf8370186a7aa6591d5fa9d853bb0 /spec/services/notification_service_spec.rb
parent283fb71e02992b6687e3264d53bbc718b7567109 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services/notification_service_spec.rb')
-rw-r--r--spec/services/notification_service_spec.rb56
1 files changed, 47 insertions, 9 deletions
diff --git a/spec/services/notification_service_spec.rb b/spec/services/notification_service_spec.rb
index 2fe7a46de4b..0ab1e816379 100644
--- a/spec/services/notification_service_spec.rb
+++ b/spec/services/notification_service_spec.rb
@@ -2054,16 +2054,54 @@ RSpec.describe NotificationService, :mailer do
end
describe '#project_was_moved' do
- it 'notifies the expected users' do
- notification.project_was_moved(project, "gitlab/gitlab")
+ context 'with users at both project and group level' do
+ let(:maintainer) { create(:user) }
+ let(:developer) { create(:user) }
+ let(:group_owner) { create(:user) }
+ let(:group_maintainer) { create(:user) }
+ let(:group_developer) { create(:user) }
+ let(:blocked_user) { create(:user, :blocked) }
+ let(:invited_user) { create(:user) }
- should_email(@u_watcher)
- should_email(@u_participating)
- should_email(@u_lazy_participant)
- should_email(@u_custom_global)
- should_not_email(@u_guest_watcher)
- should_not_email(@u_guest_custom)
- should_not_email(@u_disabled)
+ let!(:group) do
+ create(:group, :public) do |group|
+ project.group = group
+ project.save!
+
+ group.add_owner(group_owner)
+ group.add_maintainer(group_maintainer)
+ group.add_developer(group_developer)
+ # This is to check for dupes
+ group.add_maintainer(maintainer)
+ group.add_maintainer(blocked_user)
+ end
+ end
+
+ before do
+ project.add_maintainer(maintainer)
+ project.add_developer(developer)
+ project.add_maintainer(blocked_user)
+ reset_delivered_emails!
+ end
+
+ it 'notifies the expected users' do
+ notification.project_was_moved(project, "gitlab/gitlab")
+
+ should_email(@u_watcher)
+ should_email(@u_participating)
+ should_email(@u_lazy_participant)
+ should_email(@u_custom_global)
+ should_not_email(@u_guest_watcher)
+ should_not_email(@u_guest_custom)
+ should_not_email(@u_disabled)
+
+ should_email(maintainer)
+ should_email(group_owner)
+ should_email(group_maintainer)
+ should_not_email(group_developer)
+ should_not_email(developer)
+ should_not_email(blocked_user)
+ end
end
it_behaves_like 'project emails are disabled' do