diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-10 15:08:15 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-10 15:08:15 +0300 |
commit | be2696666feee6e1045e0991309b71ce7f38a413 (patch) | |
tree | 9078d7b0fb2d9ed14e22fbf783f75db4666c67e7 /spec/lib/banzai/reference_parser | |
parent | 1f64fe671ba1a368ff7e67948448b4805cdfc2db (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/banzai/reference_parser')
3 files changed, 16 insertions, 4 deletions
diff --git a/spec/lib/banzai/reference_parser/base_parser_spec.rb b/spec/lib/banzai/reference_parser/base_parser_spec.rb index d31ccccd6c3..9e77137795a 100644 --- a/spec/lib/banzai/reference_parser/base_parser_spec.rb +++ b/spec/lib/banzai/reference_parser/base_parser_spec.rb @@ -63,7 +63,7 @@ RSpec.describe Banzai::ReferenceParser::BaseParser do context 'when the link does not have a data-project attribute' do it 'returns the nodes' do - expect(subject.nodes_visible_to_user(user, [link])).to eq([link]) + expect(subject.nodes_visible_to_user(user, [link])).to match_array([link]) end end end diff --git a/spec/lib/banzai/reference_parser/commit_parser_spec.rb b/spec/lib/banzai/reference_parser/commit_parser_spec.rb index 8e962c0252e..3569a1019f0 100644 --- a/spec/lib/banzai/reference_parser/commit_parser_spec.rb +++ b/spec/lib/banzai/reference_parser/commit_parser_spec.rb @@ -31,6 +31,12 @@ RSpec.describe Banzai::ReferenceParser::CommitParser do expect(subject.nodes_visible_to_user(user, [link])).to be_empty end end + + context 'when the link does not have a data-project attribute' do + it 'returns the nodes' do + expect(subject.nodes_visible_to_user(user, [link])).to eq([link]) + end + end end describe '#referenced_by' do @@ -141,7 +147,7 @@ RSpec.describe Banzai::ReferenceParser::CommitParser do end end - context 'when checking commits on another projects' do + context 'when checking commits on another projects', :request_store do let!(:control_links) do [commit_link] end @@ -153,7 +159,7 @@ RSpec.describe Banzai::ReferenceParser::CommitParser do def commit_link project = create(:project, :repository, :public) - Nokogiri::HTML.fragment(%Q{<a data-commit="#{project.commit.id}" data-project="#{project.id}"></a>}).children[0] + Nokogiri::HTML.fragment(%(<a data-commit="#{project.commit.id}" data-project="#{project.id}"></a>)).children[0] end it_behaves_like 'no project N+1 queries' diff --git a/spec/lib/banzai/reference_parser/commit_range_parser_spec.rb b/spec/lib/banzai/reference_parser/commit_range_parser_spec.rb index 1b8214ebcbb..172347fc421 100644 --- a/spec/lib/banzai/reference_parser/commit_range_parser_spec.rb +++ b/spec/lib/banzai/reference_parser/commit_range_parser_spec.rb @@ -31,6 +31,12 @@ RSpec.describe Banzai::ReferenceParser::CommitRangeParser do expect(subject.nodes_visible_to_user(user, [link])).to be_empty end end + + context 'when the link does not have a data-project attribute' do + it 'returns the nodes' do + expect(subject.nodes_visible_to_user(user, [link])).to match_array([link]) + end + end end describe '#referenced_by' do @@ -149,7 +155,7 @@ RSpec.describe Banzai::ReferenceParser::CommitRangeParser do end end - context 'when checking commits ranges on another project' do + context 'when checking commits ranges on another projects', :request_store do let!(:control_links) do [commit_range_link] end |