gitlab-org--gitlab-foss/spec/models/integrations/slack_slash_commands_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

51 lines
1.2 KiB
Ruby
Raw Normal View History

# frozen_string_literal: true
2016-12-16 08:21:06 -05:00
require 'spec_helper'
RSpec.describe Integrations::SlackSlashCommands do
it_behaves_like Integrations::BaseSlashCommands
describe '#trigger' do
context 'when an auth url is generated' do
let(:project) { create(:project) }
let(:params) do
{
team_domain: 'http://domain.tld',
team_id: 'T3423423',
user_id: 'U234234',
user_name: 'mepmep',
token: 'token'
}
end
2016-12-19 09:40:06 -05:00
let(:integration) do
project.create_slack_slash_commands_integration(
2016-12-22 04:54:35 -05:00
properties: { token: 'token' },
active: true
)
end
2016-12-19 09:40:06 -05:00
let(:authorize_url) do
'http://authorize.example.com/'
end
before do
allow(integration).to receive(:authorize_chat_name_url).and_return(authorize_url)
end
it 'uses slack compatible links' do
response = integration.trigger(params)
expect(response[:text]).to include("<#{authorize_url}|connect your GitLab account>")
end
end
end
describe '#chat_responder' do
it 'returns the responder to use for Slack' do
expect(described_class.new.chat_responder)
.to eq(Gitlab::Chat::Responder::Slack)
end
end
2016-12-16 08:21:06 -05:00
end