diff options
Diffstat (limited to 'spec/lib/gitlab/slash_commands/presenters/deploy_spec.rb')
-rw-r--r-- | spec/lib/gitlab/slash_commands/presenters/deploy_spec.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/lib/gitlab/slash_commands/presenters/deploy_spec.rb b/spec/lib/gitlab/slash_commands/presenters/deploy_spec.rb new file mode 100644 index 00000000000..d16d122c64e --- /dev/null +++ b/spec/lib/gitlab/slash_commands/presenters/deploy_spec.rb @@ -0,0 +1,33 @@ +require 'spec_helper' + +describe Gitlab::SlashCommands::Presenters::Deploy do + 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 + + describe '#action_not_found' do + subject { described_class.new(nil).action_not_found } + + 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) + expect(subject[:text]).to eq "Couldn't find a deployment manual action." + end + end +end |