diff options
author | Rémy Coutable <remy@rymai.me> | 2016-08-10 15:12:09 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-08-13 01:06:12 +0300 |
commit | 23db6449542498636c145e83c71a4a466eb62746 (patch) | |
tree | 34619a5bccfe7864c29abfefc61268b5da86d35a /spec/lib/gitlab/slash_commands | |
parent | e021604454f1093b7d762b28eae36e30083f0053 (diff) |
Add support for no-op slash commands that appear in autocomplete
The first one is /cc
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'spec/lib/gitlab/slash_commands')
-rw-r--r-- | spec/lib/gitlab/slash_commands/dsl_spec.rb | 16 | ||||
-rw-r--r-- | spec/lib/gitlab/slash_commands/extractor_spec.rb | 4 |
2 files changed, 13 insertions, 7 deletions
diff --git a/spec/lib/gitlab/slash_commands/dsl_spec.rb b/spec/lib/gitlab/slash_commands/dsl_spec.rb index f8abb35674d..39e1996c891 100644 --- a/spec/lib/gitlab/slash_commands/dsl_spec.rb +++ b/spec/lib/gitlab/slash_commands/dsl_spec.rb @@ -29,6 +29,11 @@ describe Gitlab::SlashCommands::Dsl do command :wildcard do |*args| args end + + noop true + command :cc do |*args| + args + end end end let(:dummy) { DummyClass.new } @@ -36,11 +41,12 @@ describe Gitlab::SlashCommands::Dsl do describe '.command_definitions' do it 'returns an array with commands definitions' do expected = [ - { name: :no_args, aliases: [:none], description: 'A command with no args', params: [] }, - { name: :returning, aliases: [], description: 'A command returning a value', params: [] }, - { name: :one_arg, aliases: [:once, :first], description: '', params: ['The first argument'] }, - { name: :two_args, aliases: [], description: 'A command with two args', params: ['The first argument', 'The second argument'] }, - { name: :wildcard, aliases: [], description: '', params: [] } + { name: :no_args, aliases: [:none], description: 'A command with no args', params: [], noop: false }, + { name: :returning, aliases: [], description: 'A command returning a value', params: [], noop: false }, + { name: :one_arg, aliases: [:once, :first], description: '', params: ['The first argument'], noop: false }, + { name: :two_args, aliases: [], description: 'A command with two args', params: ['The first argument', 'The second argument'], noop: false }, + { name: :wildcard, aliases: [], description: '', params: [], noop: false }, + { name: :cc, aliases: [], description: '', params: [], noop: true } ] expect(DummyClass.command_definitions).to eq expected diff --git a/spec/lib/gitlab/slash_commands/extractor_spec.rb b/spec/lib/gitlab/slash_commands/extractor_spec.rb index 11836b10204..ac7296bdba1 100644 --- a/spec/lib/gitlab/slash_commands/extractor_spec.rb +++ b/spec/lib/gitlab/slash_commands/extractor_spec.rb @@ -175,7 +175,7 @@ describe Gitlab::SlashCommands::Extractor do end it 'does not extract commands inside a blockcode' do - msg = msg = "Hello\r\n```\r\nThis is some text\r\n/close\r\n/assign @user\r\n```\r\n\r\nWorld" + msg = "Hello\r\n```\r\nThis is some text\r\n/close\r\n/assign @user\r\n```\r\n\r\nWorld" expected = msg.delete("\r") commands = extractor.extract_commands!(msg) @@ -193,7 +193,7 @@ describe Gitlab::SlashCommands::Extractor do end it 'does not extract commands inside a HTML tag' do - msg = msg = "Hello\r\n<div>\r\nThis is some text\r\n/close\r\n/assign @user\r\n</div>\r\n\r\nWorld" + msg = "Hello\r\n<div>\r\nThis is some text\r\n/close\r\n/assign @user\r\n</div>\r\n\r\nWorld" expected = msg.delete("\r") commands = extractor.extract_commands!(msg) |