Commit 85082de7 authored by Robert Speicher's avatar Robert Speicher

Add `pipeline_result` to ReferenceFilterSpecHelper

parent 879be428
...@@ -35,6 +35,20 @@ module ReferenceFilterSpecHelper ...@@ -35,6 +35,20 @@ module ReferenceFilterSpecHelper
described_class.call(html, contexts) described_class.call(html, contexts)
end end
# Run text through HTML::Pipeline with the current filter and return the
# result Hash
#
# body - String text to run through the pipeline
# contexts - Hash context for the filter. (default: {project: project})
#
# Returns the Hash of the pipeline result
def pipeline_result(body, contexts = {})
contexts.reverse_merge!(project: project)
pipeline = HTML::Pipeline.new([described_class], contexts)
pipeline.call(body)
end
def allow_cross_reference! def allow_cross_reference!
allow_any_instance_of(described_class). allow_any_instance_of(described_class).
to receive(:user_can_reference_project?).and_return(true) to receive(:user_can_reference_project?).and_return(true)
......
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