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:
Diffstat (limited to 'spec/models/project_services/chat_notification_service_spec.rb')
-rw-r--r--spec/models/project_services/chat_notification_service_spec.rb26
1 files changed, 20 insertions, 6 deletions
diff --git a/spec/models/project_services/chat_notification_service_spec.rb b/spec/models/project_services/chat_notification_service_spec.rb
index 62f97873a06..192b1df33b5 100644
--- a/spec/models/project_services/chat_notification_service_spec.rb
+++ b/spec/models/project_services/chat_notification_service_spec.rb
@@ -89,12 +89,6 @@ RSpec.describe ChatNotificationService do
let(:data) { Gitlab::DataBuilder::Note.build(note, user) }
- it 'notifies the chat service' do
- expect(chat_service).to receive(:notify).with(any_args)
-
- chat_service.execute(data)
- end
-
shared_examples 'notifies the chat service' do
specify do
expect(chat_service).to receive(:notify).with(any_args)
@@ -111,6 +105,26 @@ RSpec.describe ChatNotificationService do
end
end
+ it_behaves_like 'notifies the chat service'
+
+ context 'with label filter' do
+ subject(:chat_service) { described_class.new(labels_to_be_notified: '~Bug') }
+
+ it_behaves_like 'notifies the chat service'
+
+ context 'MergeRequest events' do
+ let(:data) { create(:merge_request, labels: [label]).to_hook_data(user) }
+
+ it_behaves_like 'notifies the chat service'
+ end
+
+ context 'Issue events' do
+ let(:data) { issue.to_hook_data(user) }
+
+ it_behaves_like 'notifies the chat service'
+ end
+ end
+
context 'when labels_to_be_notified_behavior is not defined' do
subject(:chat_service) { described_class.new(labels_to_be_notified: label_filter) }