summaryrefslogtreecommitdiff
path: root/spec/models/project_services
diff options
context:
space:
mode:
authorGitLab Release Tools Bot <robert+release-tools@gitlab.com>2019-11-26 17:02:46 +0000
committerGitLab Release Tools Bot <robert+release-tools@gitlab.com>2019-11-26 17:02:46 +0000
commit5df019e892f4e717772133e469303ab220938233 (patch)
treec7da0e84bca09adc70e1414f89bc27aa8c39ae31 /spec/models/project_services
parent63df5d322518d2619a8b31dee09e5857d052b1af (diff)
parent729040717e887d33f776497eaefb8b8530dbe130 (diff)
downloadgitlab-ce-5df019e892f4e717772133e469303ab220938233.tar.gz
Merge branch 'security-dns-rebind-ssrf-in-slack-notifications-ce' into 'master'
Use Gitlab::HTTP for all chat notifications See merge request gitlab/gitlabhq!3517
Diffstat (limited to 'spec/models/project_services')
-rw-r--r--spec/models/project_services/chat_notification_service_spec.rb17
-rw-r--r--spec/models/project_services/slack_service_spec.rb2
2 files changed, 5 insertions, 14 deletions
diff --git a/spec/models/project_services/chat_notification_service_spec.rb b/spec/models/project_services/chat_notification_service_spec.rb
index 6f4ddd223f6..e8c5f5d611a 100644
--- a/spec/models/project_services/chat_notification_service_spec.rb
+++ b/spec/models/project_services/chat_notification_service_spec.rb
@@ -30,7 +30,8 @@ describe ChatNotificationService do
end
describe '#execute' do
- let(:chat_service) { described_class.new }
+ subject(:chat_service) { described_class.new }
+
let(:user) { create(:user) }
let(:project) { create(:project, :repository) }
let(:webhook_url) { 'https://example.gitlab.com/' }
@@ -53,12 +54,7 @@ describe ChatNotificationService do
subject.project = project
data = Gitlab::DataBuilder::Push.build_sample(project, user)
- expect(Slack::Notifier).to receive(:new)
- .with(webhook_url, {})
- .and_return(
- double(:slack_service).as_null_object
- )
-
+ expect(chat_service).to receive(:notify).and_return(true)
expect(chat_service.execute(data)).to be true
end
end
@@ -68,12 +64,7 @@ describe ChatNotificationService do
subject.project = create(:project, :empty_repo)
data = Gitlab::DataBuilder::Push.build_sample(subject.project, user)
- expect(Slack::Notifier).to receive(:new)
- .with(webhook_url, {})
- .and_return(
- double(:slack_service).as_null_object
- )
-
+ expect(chat_service).to receive(:notify).and_return(true)
expect(chat_service.execute(data)).to be true
end
end
diff --git a/spec/models/project_services/slack_service_spec.rb b/spec/models/project_services/slack_service_spec.rb
index f751dd6ffb9..93036ac7ec4 100644
--- a/spec/models/project_services/slack_service_spec.rb
+++ b/spec/models/project_services/slack_service_spec.rb
@@ -3,5 +3,5 @@
require 'spec_helper'
describe SlackService do
- it_behaves_like "slack or mattermost notifications", "Slack"
+ it_behaves_like "slack or mattermost notifications", 'Slack'
end