diff options
Diffstat (limited to 'spec/lib/gitlab/slash_commands/run_spec.rb')
-rw-r--r-- | spec/lib/gitlab/slash_commands/run_spec.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/lib/gitlab/slash_commands/run_spec.rb b/spec/lib/gitlab/slash_commands/run_spec.rb index c9ff580d586..9d204228d21 100644 --- a/spec/lib/gitlab/slash_commands/run_spec.rb +++ b/spec/lib/gitlab/slash_commands/run_spec.rb @@ -3,6 +3,26 @@ require 'spec_helper' RSpec.describe Gitlab::SlashCommands::Run do + describe '.match' do + it 'returns true for a run command' do + expect(described_class.match('run foo')).to be_an_instance_of(MatchData) + end + + it 'returns true for a run command with arguments' do + expect(described_class.match('run foo bar baz')) + .to be_an_instance_of(MatchData) + end + + it 'returns true for a command containing newlines' do + expect(described_class.match("run foo\nbar\nbaz")) + .to be_an_instance_of(MatchData) + end + + it 'returns false for an unrelated command' do + expect(described_class.match('foo bar')).to be_nil + end + end + describe '.available?' do it 'returns true when builds are enabled for the project' do project = double(:project, builds_enabled?: true) |