debian-mirror-gitlab/spec/lib/gitlab/slash_commands/application_help_spec.rb
2023-01-13 15:02:22 +05:30

40 lines
1.2 KiB
Ruby

# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Gitlab::SlashCommands::ApplicationHelp do
let(:params) { { command: '/gitlab', text: 'help' } }
let_it_be(:user) { create(:user) }
let_it_be(:chat_user) { create(:chat_name, user: user) }
let(:project) { build(:project) }
describe '#execute' do
subject do
described_class.new(project, chat_user, params).execute
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
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
end
end