diff options
Diffstat (limited to 'spec/lib/banzai/filter/abstract_reference_filter_spec.rb')
-rw-r--r-- | spec/lib/banzai/filter/abstract_reference_filter_spec.rb | 47 |
1 files changed, 19 insertions, 28 deletions
diff --git a/spec/lib/banzai/filter/abstract_reference_filter_spec.rb b/spec/lib/banzai/filter/abstract_reference_filter_spec.rb index 27684882435..7c0ba9ee67f 100644 --- a/spec/lib/banzai/filter/abstract_reference_filter_spec.rb +++ b/spec/lib/banzai/filter/abstract_reference_filter_spec.rb @@ -1,11 +1,11 @@ require 'spec_helper' describe Banzai::Filter::AbstractReferenceFilter do - let(:project) { create(:empty_project) } + let(:project) { create(:project) } describe '#references_per_project' do it 'returns a Hash containing references grouped per project paths' do - doc = Nokogiri::HTML.fragment("#1 #{project.path_with_namespace}#2") + doc = Nokogiri::HTML.fragment("#1 #{project.full_path}#2") filter = described_class.new(doc, project: project) expect(filter).to receive(:object_class).exactly(4).times.and_return(Issue) @@ -14,7 +14,7 @@ describe Banzai::Filter::AbstractReferenceFilter do refs = filter.references_per_project expect(refs).to be_an_instance_of(Hash) - expect(refs[project.path_with_namespace]).to eq(Set.new(%w[1 2])) + expect(refs[project.full_path]).to eq(Set.new(%w[1 2])) end end @@ -23,11 +23,11 @@ describe Banzai::Filter::AbstractReferenceFilter do doc = Nokogiri::HTML.fragment('') filter = described_class.new(doc, project: project) - expect(filter).to receive(:references_per_project). - and_return({ project.path_with_namespace => Set.new(%w[1]) }) + expect(filter).to receive(:references_per_project) + .and_return({ project.full_path => Set.new(%w[1]) }) - expect(filter.projects_per_reference). - to eq({ project.path_with_namespace => project }) + expect(filter.projects_per_reference) + .to eq({ project.full_path => project }) end end @@ -37,35 +37,26 @@ describe Banzai::Filter::AbstractReferenceFilter do context 'with RequestStore disabled' do it 'returns a list of Projects for a list of paths' do - expect(filter.find_projects_for_paths([project.path_with_namespace])). - to eq([project]) + expect(filter.find_projects_for_paths([project.full_path])) + .to eq([project]) end it "return an empty array for paths that don't exist" do - expect(filter.find_projects_for_paths(['nonexistent/project'])). - to eq([]) + expect(filter.find_projects_for_paths(['nonexistent/project'])) + .to eq([]) end end - context 'with RequestStore enabled' do - before do - RequestStore.begin! - end - - after do - RequestStore.end! - RequestStore.clear! - end - + context 'with RequestStore enabled', :request_store do it 'returns a list of Projects for a list of paths' do - expect(filter.find_projects_for_paths([project.path_with_namespace])). - to eq([project]) + expect(filter.find_projects_for_paths([project.full_path])) + .to eq([project]) end context "when no project with that path exists" do it "returns no value" do - expect(filter.find_projects_for_paths(['nonexistent/project'])). - to eq([]) + expect(filter.find_projects_for_paths(['nonexistent/project'])) + .to eq([]) end it "adds the ref to the project refs cache" do @@ -84,8 +75,8 @@ describe Banzai::Filter::AbstractReferenceFilter do end it "return an empty array for paths that don't exist" do - expect(filter.find_projects_for_paths(['nonexistent/project'])). - to eq([]) + expect(filter.find_projects_for_paths(['nonexistent/project'])) + .to eq([]) end end end @@ -97,7 +88,7 @@ describe Banzai::Filter::AbstractReferenceFilter do doc = Nokogiri::HTML.fragment('') filter = described_class.new(doc, project: project) - expect(filter.current_project_path).to eq(project.path_with_namespace) + expect(filter.current_project_path).to eq(project.full_path) end end end |