diff options
author | Robert Speicher <rspeicher@gmail.com> | 2015-04-15 15:27:29 -0400 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2015-04-25 14:39:44 -0400 |
commit | 85082de780b500a3469db7867cd938154fc0622f (patch) | |
tree | ebc929d56e435b7c5be1fbca86555fbcc8f11cbc /spec/support | |
parent | 879be42862e05761c5b57d31961ed1a978de957d (diff) | |
download | gitlab-ce-85082de780b500a3469db7867cd938154fc0622f.tar.gz |
Add `pipeline_result` to ReferenceFilterSpecHelper
Diffstat (limited to 'spec/support')
-rw-r--r-- | spec/support/reference_filter_spec_helper.rb | 14 |
1 files changed, 14 insertions, 0 deletions
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) |