From d244360d8b38218bd3e71c0203e9f2af41498daa Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Fri, 10 Mar 2023 17:37:58 +0000 Subject: Add latest changes from gitlab-org/gitlab@15-9-stable-ee --- lib/gitlab/regex.rb | 2 +- spec/fast_spec_helper.rb | 1 + spec/lib/gitlab/regex_spec.rb | 6 ++++-- spec/models/concerns/taskable_spec.rb | 16 ++++++++++++++++ 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/lib/gitlab/regex.rb b/lib/gitlab/regex.rb index e76056709e9..93d23add5eb 100644 --- a/lib/gitlab/regex.rb +++ b/lib/gitlab/regex.rb @@ -466,7 +466,7 @@ module Gitlab # HTML comment line: # - ^\ *$ + ^\ *$ ) }mx.freeze diff --git a/spec/fast_spec_helper.rb b/spec/fast_spec_helper.rb index e53f0cd936f..0df771b4025 100644 --- a/spec/fast_spec_helper.rb +++ b/spec/fast_spec_helper.rb @@ -21,6 +21,7 @@ require_relative 'support/rspec' require_relative '../lib/gitlab/utils' require_relative '../lib/gitlab/utils/strong_memoize' require 'active_support/all' +require 'pry' require_relative 'simplecov_env' SimpleCovEnv.start! diff --git a/spec/lib/gitlab/regex_spec.rb b/spec/lib/gitlab/regex_spec.rb index caca33704dd..31de4068bc5 100644 --- a/spec/lib/gitlab/regex_spec.rb +++ b/spec/lib/gitlab/regex_spec.rb @@ -1142,7 +1142,7 @@ RSpec.describe Gitlab::Regex, feature_category: :tooling do context 'HTML comment lines' do subject { described_class::MARKDOWN_HTML_COMMENT_LINE_REGEX } - let(:expected) { %() } + let(:expected) { [[''], ['']] } let(:markdown) do <<~MARKDOWN Regular text @@ -1150,13 +1150,15 @@ RSpec.describe Gitlab::Regex, feature_category: :tooling do more text + + MARKDOWN end it { is_expected.to match(%()) } it { is_expected.not_to match(%()) } it { is_expected.not_to match(%(must start in first column )) } - it { expect(subject.match(markdown)[:html_comment_line]).to eq expected } + it { expect(markdown.scan(subject)).to eq expected } end context 'HTML comment blocks' do diff --git a/spec/models/concerns/taskable_spec.rb b/spec/models/concerns/taskable_spec.rb index 0ad29454ff3..14f346f353b 100644 --- a/spec/models/concerns/taskable_spec.rb +++ b/spec/models/concerns/taskable_spec.rb @@ -46,6 +46,22 @@ RSpec.describe Taskable, feature_category: :team_planning do subject { described_class.get_tasks(description) } it { is_expected.to match(expected_result) } + + describe 'with single line comments' do + let(:description) do + <<~MARKDOWN + + + - [ ] only task item + + + MARKDOWN + end + + let(:expected_result) { [TaskList::Item.new('- [ ]', 'only task item')] } + + it { is_expected.to match(expected_result) } + end end describe '#task_list_items' do -- cgit v1.2.1