Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
486ad968
Commit
486ad968
authored
Jul 06, 2020
by
nmilojevic1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename nodes to reference_filter_nodes
- Update specs
parent
9bd33333
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
11 deletions
+11
-11
lib/banzai/filter/reference_filter.rb
lib/banzai/filter/reference_filter.rb
+2
-2
spec/lib/banzai/filter/reference_filter_spec.rb
spec/lib/banzai/filter/reference_filter_spec.rb
+5
-5
spec/lib/banzai/pipeline/gfm_pipeline_spec.rb
spec/lib/banzai/pipeline/gfm_pipeline_spec.rb
+4
-4
No files found.
lib/banzai/filter/reference_filter.rb
View file @
486ad968
...
...
@@ -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?
...
...
spec/lib/banzai/filter/reference_filter_spec.rb
View file @
486ad968
...
...
@@ -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
...
...
spec/lib/banzai/pipeline/gfm_pipeline_spec.rb
View file @
486ad968
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment