summaryrefslogtreecommitdiff
path: root/spec/models
diff options
context:
space:
mode:
authorMarin Jankovski <maxlazio@gmail.com>2014-10-06 10:42:03 +0200
committerMarin Jankovski <maxlazio@gmail.com>2014-10-06 10:44:01 +0200
commite5998adc26f66b2b84cbcc28e98f3fc8f89b4696 (patch)
treecffd9d72df175ccf312eb01d28f2fc46c26f9c67 /spec/models
parent216fb6ee07b80c2cb6cd78fdcb52c898fa2f41ea (diff)
downloadgitlab-ce-e5998adc26f66b2b84cbcc28e98f3fc8f89b4696.tar.gz
Accommodate new webhook url format.
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/slack_service_spec.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/models/slack_service_spec.rb b/spec/models/slack_service_spec.rb
index 5f919d97300..3e555193b32 100644
--- a/spec/models/slack_service_spec.rb
+++ b/spec/models/slack_service_spec.rb
@@ -32,10 +32,12 @@ describe SlackService do
describe "Execute" do
let(:slack) { SlackService.new }
+ let(:slack_service) { SlackService.new }
let(:user) { create(:user) }
let(:project) { create(:project) }
let(:sample_data) { GitPushService.new.sample_data(project, user) }
let(:webhook) { 'https://gitlabhq.slack.com/services/hooks?token=cdIj4r4LfXUOySDUjp0tk3OI' }
+ let(:new_webhook) { 'https://hooks.gitlabhq.slack.com/services/cdIj4r4LfXUOySDUjp0tk3OI' }
let(:api_url) {
'https://gitlabhq.slack.com/services/hooks/incoming-webhook?token=cdIj4r4LfXUOySDUjp0tk3OI'
}
@@ -56,5 +58,24 @@ describe SlackService do
WebMock.should have_requested(:post, api_url).once
end
+
+ context 'with new webhook syntax' do
+ before do
+ slack_service.stub(
+ project: project,
+ project_id: project.id,
+ service_hook: true,
+ webhook: new_webhook
+ )
+
+ WebMock.stub_request(:post, api_url)
+ end
+
+ it "should call Slack API" do
+ slack_service.execute(sample_data)
+
+ WebMock.should have_requested(:post, api_url).once
+ end
+ end
end
end