diff options
author | Bob Van Landuyt <bob@vanlanduyt.co> | 2018-11-07 15:33:42 +0300 |
---|---|---|
committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2018-11-07 18:27:55 +0300 |
commit | c85a19f920da1b544bbfae344145503c25e71048 (patch) | |
tree | 8acaf8e1b6cac9e71dbf545e8cf1443d03931280 /spec/lib/gitlab/quick_actions | |
parent | 6fbdc5ed5224154b89cf351e11a8f9db48e6d7f0 (diff) |
Allow limiting quick actions to execute
Sometimes we don't want to trigger any quick actions that cause side
effects. For example when building a record to validate. This allows
listing the quick actions that need to be performed.
Diffstat (limited to 'spec/lib/gitlab/quick_actions')
-rw-r--r-- | spec/lib/gitlab/quick_actions/extractor_spec.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/lib/gitlab/quick_actions/extractor_spec.rb b/spec/lib/gitlab/quick_actions/extractor_spec.rb index 0166f6c2ee0..873bb359d6e 100644 --- a/spec/lib/gitlab/quick_actions/extractor_spec.rb +++ b/spec/lib/gitlab/quick_actions/extractor_spec.rb @@ -272,5 +272,24 @@ describe Gitlab::QuickActions::Extractor do expect(commands).to be_empty expect(msg).to eq expected end + + it 'limits to passed commands when they are passed' do + msg = <<~MSG.strip + Hello, we should only extract the commands passed + /reopen + /labels hello world + /power + MSG + expected_msg = <<~EXPECTED.strip + Hello, we should only extract the commands passed + /power + EXPECTED + expected_commands = [['reopen'], ['labels', 'hello world']] + + msg, commands = extractor.extract_commands(msg, only: [:open, :labels]) + + expect(commands).to eq(expected_commands) + expect(msg).to eq expected_msg + end end end |