From b98fa9ef3d5bead417ae2f325cb64637883264e9 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Tue, 25 Feb 2020 09:09:10 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- spec/lib/gitlab/quick_actions/extractor_spec.rb | 16 ++++++++++++++++ .../gitlab/quick_actions/substitution_definition_spec.rb | 2 ++ 2 files changed, 18 insertions(+) (limited to 'spec/lib') diff --git a/spec/lib/gitlab/quick_actions/extractor_spec.rb b/spec/lib/gitlab/quick_actions/extractor_spec.rb index 2536e4a372b..1843acb0cc0 100644 --- a/spec/lib/gitlab/quick_actions/extractor_spec.rb +++ b/spec/lib/gitlab/quick_actions/extractor_spec.rb @@ -216,6 +216,22 @@ describe Gitlab::QuickActions::Extractor do expect(msg).to eq "hello\nworld\nthis is great? SHRUG" end + it 'extracts and performs multiple substitution commands' do + msg = %(hello\nworld\n/reopen\n/shrug this is great?\n/shrug meh) + msg, commands = extractor.extract_commands(msg) + + expect(commands).to eq [['reopen'], ['shrug', 'this is great?'], %w(shrug meh)] + expect(msg).to eq "hello\nworld\nthis is great? SHRUG\nmeh SHRUG" + end + + it 'does not extract substitution command in inline code' do + msg = %(hello\nworld\n/reopen\n`/tableflip this is great`?) + msg, commands = extractor.extract_commands(msg) + + expect(commands).to eq [['reopen']] + expect(msg).to eq "hello\nworld\n`/tableflip this is great`?" + end + it 'extracts and performs substitution commands case insensitive' do msg = %(hello\nworld\n/reOpen\n/sHRuG this is great?) msg, commands = extractor.extract_commands(msg) diff --git a/spec/lib/gitlab/quick_actions/substitution_definition_spec.rb b/spec/lib/gitlab/quick_actions/substitution_definition_spec.rb index a09aca31cdc..d1a44e2feeb 100644 --- a/spec/lib/gitlab/quick_actions/substitution_definition_spec.rb +++ b/spec/lib/gitlab/quick_actions/substitution_definition_spec.rb @@ -7,6 +7,7 @@ describe Gitlab::QuickActions::SubstitutionDefinition do <