diff options
author | Steven Sloan <stevenosloan@gmail.com> | 2014-10-23 14:47:28 -0400 |
---|---|---|
committer | Steven Sloan <stevenosloan@gmail.com> | 2014-10-23 14:47:28 -0400 |
commit | 7b339e61e8e4a93798807f3c90bf7179a0ecd28b (patch) | |
tree | 5ef7aecca3959eb8c097fea5815bf65bc26179e7 /spec/models | |
parent | c6efa56ee7039882625942ce29ea9fdeeffaa6cd (diff) | |
download | gitlab-ce-7b339e61e8e4a93798807f3c90bf7179a0ecd28b.tar.gz |
update slack-notifier to 1.0.0, use raw webhook_url per slack recommendation
per changes with slack, they’re now using “static” web hook urls that describe the team & service with IDs that don’t change if the team or service name change. their recommendation is to use the raw webhook_url instead of building it out of components to allow more flexibility
this should also prevent issues cropping up with mistakes in how the urls are parsed
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/slack_service_spec.rb | 56 |
1 files changed, 6 insertions, 50 deletions
diff --git a/spec/models/slack_service_spec.rb b/spec/models/slack_service_spec.rb index 526165e397c..d4840391967 100644 --- a/spec/models/slack_service_spec.rb +++ b/spec/models/slack_service_spec.rb @@ -31,71 +31,27 @@ describe SlackService do end describe "Execute" do - let(:slack) { SlackService.new } - let(:slack_service) { SlackService.new } - let(:user) { create(:user) } + let(:slack) { 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' - } + let(:webhook_url) { 'https://hooks.slack.com/services/SVRWFV0VVAR97N/B02R25XN3/ZBqu7xMupaEEICInN685' } before do slack.stub( project: project, project_id: project.id, service_hook: true, - webhook: webhook + webhook: webhook_url ) - WebMock.stub_request(:post, api_url) + WebMock.stub_request(:post, webhook_url) end it "should call Slack API" do slack.execute(sample_data) - 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 - - context 'with new webhook syntax with slack allowed team name' do - before do - @allowed_webhook = 'https://gitlab-hq-123.slack.com/services/hooks/incoming-webhook?token=cdIj4r4LfXUOySDUjp0tk3OI' - slack_service.stub( - project: project, - project_id: project.id, - service_hook: true, - webhook: @allowed_webhook - ) - - WebMock.stub_request(:post, @allowed_webhook) - end - - it "should call Slack API" do - slack_service.execute(sample_data) - - WebMock.should have_requested(:post, @allowed_webhook).once - end + WebMock.should have_requested(:post, webhook_url).once end end end |