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
path: root/spec
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-05-27 00:08:54 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-05-27 00:08:54 +0300
commit1c47c8e2d613829993eafb59a903223389389d86 (patch)
tree93178fb6e59e731ab7d1c1261e99457a06e8aa73 /spec
parentf52b15b6398075127f4c583823fd72d4a6ec5e59 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r--spec/serializers/deployment_entity_spec.rb2
-rw-r--r--spec/services/notification_service_spec.rb27
2 files changed, 16 insertions, 13 deletions
diff --git a/spec/serializers/deployment_entity_spec.rb b/spec/serializers/deployment_entity_spec.rb
index 4452ccbcf07..a017f7523e9 100644
--- a/spec/serializers/deployment_entity_spec.rb
+++ b/spec/serializers/deployment_entity_spec.rb
@@ -69,7 +69,7 @@ RSpec.describe DeploymentEntity do
it 'returns another manual action' do
expect(subject[:manual_actions].count).to eq(2)
- expect(subject[:manual_actions].second[:name]).to eq('another deploy')
+ expect(subject[:manual_actions].pluck(:name)).to match_array(['test', 'another deploy'])
end
context 'when user is a reporter' do
diff --git a/spec/services/notification_service_spec.rb b/spec/services/notification_service_spec.rb
index 743a04eabe6..032f35cfc29 100644
--- a/spec/services/notification_service_spec.rb
+++ b/spec/services/notification_service_spec.rb
@@ -975,10 +975,17 @@ RSpec.describe NotificationService, :mailer do
end
describe '#send_new_release_notifications', :deliver_mails_inline do
- let(:release) { create(:release, author: current_user) }
+ let(:release) { create(:release, project: project, author: current_user) }
let(:object) { release }
let(:action) { notification.send_new_release_notifications(release) }
+ before_all do
+ build_team(project)
+
+ update_custom_notification(:new_release, @u_guest_custom, resource: project)
+ update_custom_notification(:new_release, @u_custom_global)
+ end
+
context 'when release author is blocked' do
let(:current_user) { create(:user, :blocked) }
@@ -994,19 +1001,15 @@ RSpec.describe NotificationService, :mailer do
context 'when recipients for a new release exist' do
let(:current_user) { create(:user) }
- it 'calls new_release_email for each relevant recipient' do
- user_1 = create(:user)
- user_2 = create(:user)
- user_3 = create(:user)
- recipient_1 = NotificationRecipient.new(user_1, :custom, custom_action: :new_release)
- recipient_2 = NotificationRecipient.new(user_2, :custom, custom_action: :new_release)
- allow(NotificationRecipients::BuildService).to receive(:build_new_release_recipients).and_return([recipient_1, recipient_2])
-
+ it 'notifies the expected users' do
notification.send_new_release_notifications(release)
- should_email(user_1)
- should_email(user_2)
- should_not_email(user_3)
+ should_only_email(
+ @u_watcher,
+ @u_guest_watcher,
+ @u_custom_global,
+ @u_guest_custom
+ )
end
end
end