2019-07-07 11:18:12 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
RSpec.describe Gitlab::SlashCommands::ApplicationHelp do
|
2019-07-07 11:18:12 +05:30
|
|
|
let(:params) { { command: '/gitlab', text: 'help' } }
|
2019-12-04 20:38:33 +05:30
|
|
|
let(:project) { build(:project) }
|
2019-07-07 11:18:12 +05:30
|
|
|
|
|
|
|
describe '#execute' do
|
|
|
|
subject do
|
2023-03-04 22:38:38 +05:30
|
|
|
described_class.new(project, params).execute
|
2019-07-07 11:18:12 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'displays the help section' do
|
|
|
|
expect(subject[:response_type]).to be(:ephemeral)
|
|
|
|
expect(subject[:text]).to include('Available commands')
|
|
|
|
expect(subject[:text]).to include('/gitlab [project name or alias] issue show')
|
|
|
|
end
|
2023-01-13 00:05:48 +05:30
|
|
|
|
|
|
|
context 'with incident declare command' do
|
|
|
|
context 'when feature flag is enabled' do
|
|
|
|
it 'displays the declare command' do
|
|
|
|
expect(subject[:text]).to include('/gitlab incident declare')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when feature flag is disabled' do
|
|
|
|
before do
|
|
|
|
stub_feature_flags(incident_declare_slash_command: false)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'does not displays the declare command' do
|
|
|
|
expect(subject[:text]).not_to include('/gitlab incident declare')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2019-07-07 11:18:12 +05:30
|
|
|
end
|
|
|
|
end
|