summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/quick_actions/extractor_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/gitlab/quick_actions/extractor_spec.rb')
-rw-r--r--spec/lib/gitlab/quick_actions/extractor_spec.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/lib/gitlab/quick_actions/extractor_spec.rb b/spec/lib/gitlab/quick_actions/extractor_spec.rb
index 1843acb0cc0..6ea597bf01e 100644
--- a/spec/lib/gitlab/quick_actions/extractor_spec.rb
+++ b/spec/lib/gitlab/quick_actions/extractor_spec.rb
@@ -291,6 +291,33 @@ describe Gitlab::QuickActions::Extractor do
expect(msg).to eq expected
end
+ it 'does not extract commands in multiline inline code on seperated rows' do
+ 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")
+ msg, commands = extractor.extract_commands(msg)
+
+ expect(commands).to be_empty
+ expect(msg).to eq expected
+ end
+
+ it 'does not extract commands in multiline inline code starting from text' do
+ msg = "Hello `This is some text\r\n/close\r\n/assign @user\r\n`\r\n\r\nWorld"
+ expected = msg.delete("\r")
+ msg, commands = extractor.extract_commands(msg)
+
+ expect(commands).to be_empty
+ expect(msg).to eq expected
+ end
+
+ it 'does not extract commands in inline code' do
+ msg = "`This is some text\r\n/close\r\n/assign @user\r\n`\r\n\r\nWorld"
+ expected = msg.delete("\r")
+ msg, commands = extractor.extract_commands(msg)
+
+ 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