debian-mirror-gitlab/spec/models/integrations/slack_slash_commands_spec.rb

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
let(:service) do
project.create_slack_slash_commands_service(
properties: { token: 'token' },
active: true
)
end
let(:authorize_url) do
'http://authorize.example.com/'
end
before do
allow(service).to receive(:authorize_chat_name_url).and_return(authorize_url)
end
it 'uses slack compatible links' do
response = service.trigger(params)
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