From 85082de780b500a3469db7867cd938154fc0622f Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Wed, 15 Apr 2015 15:27:29 -0400 Subject: [PATCH] Add `pipeline_result` to ReferenceFilterSpecHelper --- spec/support/reference_filter_spec_helper.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/spec/support/reference_filter_spec_helper.rb b/spec/support/reference_filter_spec_helper.rb index bcee5715cad..41253811490 100644 --- a/spec/support/reference_filter_spec_helper.rb +++ b/spec/support/reference_filter_spec_helper.rb @@ -35,6 +35,20 @@ module ReferenceFilterSpecHelper described_class.call(html, contexts) 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! allow_any_instance_of(described_class). to receive(:user_can_reference_project?).and_return(true)