diff options
Diffstat (limited to 'spec/lib/gitlab/chat_commands/command_spec.rb')
-rw-r--r-- | spec/lib/gitlab/chat_commands/command_spec.rb | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/spec/lib/gitlab/chat_commands/command_spec.rb b/spec/lib/gitlab/chat_commands/command_spec.rb index bbd47f45761..328187b5048 100644 --- a/spec/lib/gitlab/chat_commands/command_spec.rb +++ b/spec/lib/gitlab/chat_commands/command_spec.rb @@ -1,19 +1,19 @@ require 'spec_helper' describe Gitlab::ChatCommands::Command, service: true do - let(:project) { create(:project) } - let(:user) { create(:user) } - let(:params) { { text: 'issue show 1' } } + let(:project) { create(:project) } + let(:user) { create(:user) } subject { described_class.new(project, user, params).execute } describe '#execute' do - context 'when the command is not available' do + context 'when no command is not available' do + let(:params) { { text: 'issue show 1' } } let(:project) { create(:project, has_external_issue_tracker: true) } it 'displays the help message' do expect(subject[:response_type]).to be(:ephemeral) - expect(subject[:text]).to start_with('Available commands') + expect(subject[:text]).to start_with('404 not found') end end @@ -25,5 +25,17 @@ describe Gitlab::ChatCommands::Command, service: true do expect(subject[:text]).to start_with('Available commands') end end + + context 'issue is succesfully created' do + let(:params) { { text: "issue create my new issue" } } + + before do + project.team << [user, :master] + end + + it 'presents the issue' do + expect(subject[:text]).to match("my new issue") + end + end end end |