debian-mirror-gitlab/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

2019-07-07 11:18:12 +05:30
# frozen_string_literal: true
2017-08-17 22:00:37 +05:30
require 'spec_helper'
2021-09-04 01:27:46 +05:30
RSpec.describe Integrations::SlackSlashCommands do
it_behaves_like Integrations::BaseSlashCommands
2017-08-17 22:00:37 +05:30
describe '#trigger' do
context 'when an auth url is generated' do
2017-09-10 17:25:29 +05:30
let(:project) { create(:project) }
2017-08-17 22:00:37 +05:30
let(:params) do
{
team_domain: 'http://domain.tld',
team_id: 'T3423423',
user_id: 'U234234',
user_name: 'mepmep',
token: 'token'
}
end
2021-09-30 23:02:18 +05:30
let(:integration) do
project.create_slack_slash_commands_integration(
2017-08-17 22:00:37 +05:30
properties: { token: 'token' },
active: true
)
end
let(:authorize_url) do
'http://authorize.example.com/'
end
before do
2021-09-30 23:02:18 +05:30
allow(integration).to receive(:authorize_chat_name_url).and_return(authorize_url)
2017-08-17 22:00:37 +05:30
end
it 'uses slack compatible links' do
2021-09-30 23:02:18 +05:30
response = integration.trigger(params)
2017-08-17 22:00:37 +05:30
expect(response[:text]).to include("<#{authorize_url}|connect your GitLab account>")
end
end
end
2019-07-07 11:18:12 +05:30
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
2017-08-17 22:00:37 +05:30
end