diff options
author | Alex Ives <alex@ives.mn> | 2017-07-24 22:11:22 -0500 |
---|---|---|
committer | Alex Ives <alex@ives.mn> | 2017-07-28 14:37:44 -0500 |
commit | a07fe9d7f8f922020472ed54b060430a6da3da69 (patch) | |
tree | 0dec18fd2ed81985112ce1a2cee1bcde37e12155 /spec/lib/gitlab/quick_actions/dsl_spec.rb | |
parent | da967803cce971b184873dbe5d65d07215de0b0a (diff) | |
download | gitlab-ce-a07fe9d7f8f922020472ed54b060430a6da3da69.tar.gz |
Fixes #29385: Add /shrug and /tableflip commands
- Updated DSL to support substitution definitions
- Added substitution definition, inherits from command definition
- Added tabelflip and shrug substitutions to interpret service
- Added support for substitution definitions to the extractor for preview mode.
- Added substitution handling in the interpret service
Signed-off-by: Alex Ives <alex@ives.mn>
Diffstat (limited to 'spec/lib/gitlab/quick_actions/dsl_spec.rb')
-rw-r--r-- | spec/lib/gitlab/quick_actions/dsl_spec.rb | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/spec/lib/gitlab/quick_actions/dsl_spec.rb b/spec/lib/gitlab/quick_actions/dsl_spec.rb index a4bb3f911d7..ff59dc48bcb 100644 --- a/spec/lib/gitlab/quick_actions/dsl_spec.rb +++ b/spec/lib/gitlab/quick_actions/dsl_spec.rb @@ -42,13 +42,18 @@ describe Gitlab::QuickActions::Dsl do command :with_params_parsing do |parsed| parsed end + + params '<Comment>' + substitution :something do |text| + "#{text} Some complicated thing you want in here" + end end end describe '.command_definitions' do it 'returns an array with commands definitions' do no_args_def, explanation_with_aliases_def, dynamic_description_def, - cc_def, cond_action_def, with_params_parsing_def = + cc_def, cond_action_def, with_params_parsing_def, substitution_def = DummyClass.command_definitions expect(no_args_def.name).to eq(:no_args) @@ -104,6 +109,15 @@ describe Gitlab::QuickActions::Dsl do expect(with_params_parsing_def.condition_block).to be_nil expect(with_params_parsing_def.action_block).to be_a_kind_of(Proc) expect(with_params_parsing_def.parse_params_block).to be_a_kind_of(Proc) + + expect(substitution_def.name).to eq(:something) + expect(substitution_def.aliases).to eq([]) + expect(substitution_def.description).to eq('') + expect(substitution_def.explanation).to eq('') + expect(substitution_def.params).to eq(['<Comment>']) + expect(substitution_def.condition_block).to be_nil + expect(substitution_def.action_block.call('text')).to eq('text Some complicated thing you want in here') + expect(substitution_def.parse_params_block).to be_nil end end end |