diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 14:18:50 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 14:18:50 +0300 |
commit | 8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781 (patch) | |
tree | a77e7fe7a93de11213032ed4ab1f33a3db51b738 /spec/support/helpers/filter_spec_helper.rb | |
parent | 00b35af3db1abfe813a778f643dad221aad51fca (diff) |
Add latest changes from gitlab-org/gitlab@13-1-stable-ee
Diffstat (limited to 'spec/support/helpers/filter_spec_helper.rb')
-rw-r--r-- | spec/support/helpers/filter_spec_helper.rb | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/spec/support/helpers/filter_spec_helper.rb b/spec/support/helpers/filter_spec_helper.rb index c165128040f..ca844b33ba8 100644 --- a/spec/support/helpers/filter_spec_helper.rb +++ b/spec/support/helpers/filter_spec_helper.rb @@ -56,14 +56,11 @@ module FilterSpecHelper pipeline.call(body) end - def reference_pipeline(context = {}) + def reference_pipeline(filter: described_class, **context) context.reverse_merge!(project: project) if defined?(project) context.reverse_merge!(current_user: current_user) if defined?(current_user) - filters = [ - Banzai::Filter::AutolinkFilter, - described_class - ] + filters = [Banzai::Filter::AutolinkFilter, filter].compact redact = context.delete(:redact) filters.push(Banzai::Filter::ReferenceRedactorFilter) if redact @@ -75,8 +72,13 @@ module FilterSpecHelper reference_pipeline(context).call(body) end - def reference_filter(html, context = {}) - reference_pipeline(context).to_document(html) + def reference_filter(text, context = {}) + reference_pipeline(**context).to_document(text) + end + + # Use to test no-ops + def null_filter(text, context = {}) + reference_pipeline(filter: nil, **context).to_document(text) end # Modify a String reference to make it invalid |