Commit 486ad968 authored by nmilojevic1's avatar nmilojevic1

Rename nodes to reference_filter_nodes

- Update specs
parent 9bd33333
......@@ -27,7 +27,7 @@ module Banzai
if update_nodes_enabled?
@changed_nodes = {}
@nodes = self.result[:nodes]
@nodes = self.result[:reference_filter_nodes]
end
end
......@@ -207,7 +207,7 @@ module Banzai
@changed_nodes.sort_by { |index, _changed_nodes| -index }.each do |index, changed_nodes|
nodes[index, 1] = changed_nodes
end
result[:nodes] = nodes
result[:reference_filter_nodes] = nodes
end
def update_nodes_enabled?
......
......@@ -231,7 +231,7 @@ RSpec.describe Banzai::Filter::ReferenceFilter do
filter.call_and_update_nodes
expect(filter.result[:nodes]).to eq(expected_nodes)
expect(filter.result[:reference_filter_nodes]).to eq(expected_nodes)
end
end
......@@ -254,7 +254,7 @@ RSpec.describe Banzai::Filter::ReferenceFilter do
filter.call_and_update_nodes
expect(filter.nodes).to eq(nodes)
expect(filter.result[:nodes]).to be nil
expect(filter.result[:reference_filter_nodes]).to be nil
end
end
end
......@@ -264,7 +264,7 @@ RSpec.describe Banzai::Filter::ReferenceFilter do
let(:document) { Nokogiri::HTML.fragment('<a href="foo">foo</a>') }
let(:result) { { nodes: nodes } }
let(:result) { { reference_filter_nodes: nodes } }
before do
stub_feature_flags(update_nodes_for_banzai_reference_filter: true)
......@@ -280,7 +280,7 @@ RSpec.describe Banzai::Filter::ReferenceFilter do
described_class.call(document, { project: project }, result)
expect(result[:nodes]).to eq(expected_nodes)
expect(result[:reference_filter_nodes]).to eq(expected_nodes)
end
context "with update_nodes_for_banzai_reference_filter feature flag disabled" do
......@@ -300,7 +300,7 @@ RSpec.describe Banzai::Filter::ReferenceFilter do
described_class.call(document, { project: project }, result)
expect(result[:nodes]).to be nil
expect(result[:reference_filter_nodes]).to be nil
end
end
end
......
......@@ -8,7 +8,7 @@ RSpec.describe Banzai::Pipeline::GfmPipeline do
context 'when internal issue tracker is enabled' do
context 'when shorthand pattern #ISSUE_ID is used' do
it 'links an internal issues and keep updated nodes in result[:nodes]', :aggregate_failures do
it 'links an internal issues and keep updated nodes in result[:reference_filter_nodes]', :aggregate_failures do
issue = create(:issue, project: project)
markdown = "text #{issue.to_reference(project, full: true)}"
......@@ -17,7 +17,7 @@ RSpec.describe Banzai::Pipeline::GfmPipeline do
text = result[:output].children.first
expect(link['href']).to eq(Gitlab::Routing.url_helpers.project_issue_path(project, issue))
expect(result[:nodes]).to eq([text])
expect(result[:reference_filter_nodes]).to eq([text])
end
end
......@@ -36,14 +36,14 @@ RSpec.describe Banzai::Pipeline::GfmPipeline do
end
context 'when shorthand pattern #ISSUE_ID is used' do
it 'links an internal issues and doesnt store nodes in result[:nodes]', :aggregate_failures do
it 'links an internal issues and doesnt store nodes in result[:reference_filter_nodes]', :aggregate_failures do
issue = create(:issue, project: project)
markdown = "text #{issue.to_reference(project, full: true)}"
result = described_class.call(markdown, project: project)
link = result[:output].css('a').first
expect(link['href']).to eq(Gitlab::Routing.url_helpers.project_issue_path(project, issue))
expect(result[:nodes]).to eq nil
expect(result[:reference_filter_nodes]).to eq nil
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment