2017-01-10 13:43:58 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-05-31 01:50:53 -04:00
|
|
|
describe Gitlab::SlashCommands::Presenters::Deploy do
|
2017-01-10 13:43:58 -05:00
|
|
|
let(:build) { create(:ci_build) }
|
|
|
|
|
|
|
|
describe '#present' do
|
|
|
|
subject { described_class.new(build).present('staging', 'prod') }
|
|
|
|
|
|
|
|
it { is_expected.to have_key(:text) }
|
|
|
|
it { is_expected.to have_key(:response_type) }
|
|
|
|
it { is_expected.to have_key(:status) }
|
|
|
|
it { is_expected.not_to have_key(:attachments) }
|
|
|
|
|
|
|
|
it 'messages the channel of the deploy' do
|
|
|
|
expect(subject[:response_type]).to be(:in_channel)
|
|
|
|
expect(subject[:text]).to start_with("Deployment started from staging to prod")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-07-28 04:56:50 -04:00
|
|
|
describe '#action_not_found' do
|
|
|
|
subject { described_class.new(nil).action_not_found }
|
2017-01-10 13:43:58 -05:00
|
|
|
|
|
|
|
it { is_expected.to have_key(:text) }
|
|
|
|
it { is_expected.to have_key(:response_type) }
|
|
|
|
it { is_expected.to have_key(:status) }
|
|
|
|
it { is_expected.not_to have_key(:attachments) }
|
|
|
|
|
|
|
|
it 'tells the user there is no action' do
|
|
|
|
expect(subject[:response_type]).to be(:ephemeral)
|
2017-07-28 06:16:07 -04:00
|
|
|
expect(subject[:text]).to eq "Couldn't find a deployment manual action."
|
2017-01-10 13:43:58 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|