diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-12-15 15:51:16 +0100 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-12-15 15:51:16 +0100 |
commit | 7781bda9bd82997f4a03de4cf911b1156ceb2cde (patch) | |
tree | a632a12b295694232205e2190f784f9bb79235ee /spec | |
parent | 9451db3819ae45734c4343e55a74d347cdacf70d (diff) | |
download | gitlab-ce-7781bda9bd82997f4a03de4cf911b1156ceb2cde.tar.gz |
Move Markdown/reference logic from Gitlab::Markdown to Banzai
Diffstat (limited to 'spec')
-rw-r--r-- | spec/benchmarks/lib/gitlab/markdown/reference_filter_spec.rb | 2 | ||||
-rw-r--r-- | spec/lib/banzai/cross_project_reference_spec.rb (renamed from spec/lib/gitlab/markdown/cross_project_reference_spec.rb) | 2 | ||||
-rw-r--r-- | spec/lib/banzai/filter/autolink_filter_spec.rb (renamed from spec/lib/gitlab/markdown/filter/autolink_filter_spec.rb) | 2 | ||||
-rw-r--r-- | spec/lib/banzai/filter/commit_range_reference_filter_spec.rb (renamed from spec/lib/gitlab/markdown/filter/commit_range_reference_filter_spec.rb) | 2 | ||||
-rw-r--r-- | spec/lib/banzai/filter/commit_reference_filter_spec.rb (renamed from spec/lib/gitlab/markdown/filter/commit_reference_filter_spec.rb) | 2 | ||||
-rw-r--r-- | spec/lib/banzai/filter/emoji_filter_spec.rb (renamed from spec/lib/gitlab/markdown/filter/emoji_filter_spec.rb) | 2 | ||||
-rw-r--r-- | spec/lib/banzai/filter/external_issue_reference_filter_spec.rb (renamed from spec/lib/gitlab/markdown/filter/external_issue_reference_filter_spec.rb) | 2 | ||||
-rw-r--r-- | spec/lib/banzai/filter/external_link_filter_spec.rb (renamed from spec/lib/gitlab/markdown/filter/external_link_filter_spec.rb) | 2 | ||||
-rw-r--r-- | spec/lib/banzai/filter/issue_reference_filter_spec.rb (renamed from spec/lib/gitlab/markdown/filter/issue_reference_filter_spec.rb) | 2 | ||||
-rw-r--r-- | spec/lib/banzai/filter/label_reference_filter_spec.rb (renamed from spec/lib/gitlab/markdown/filter/label_reference_filter_spec.rb) | 2 | ||||
-rw-r--r-- | spec/lib/banzai/filter/merge_request_reference_filter_spec.rb (renamed from spec/lib/gitlab/markdown/filter/merge_request_reference_filter_spec.rb) | 2 | ||||
-rw-r--r-- | spec/lib/banzai/filter/redactor_filter_spec.rb (renamed from spec/lib/gitlab/markdown/filter/redactor_filter_spec.rb) | 2 | ||||
-rw-r--r-- | spec/lib/banzai/filter/reference_gatherer_filter_spec.rb (renamed from spec/lib/gitlab/markdown/filter/reference_gatherer_filter_spec.rb) | 2 | ||||
-rw-r--r-- | spec/lib/banzai/filter/relative_link_filter_spec.rb (renamed from spec/lib/gitlab/markdown/filter/relative_link_filter_spec.rb) | 2 | ||||
-rw-r--r-- | spec/lib/banzai/filter/sanitization_filter_spec.rb (renamed from spec/lib/gitlab/markdown/filter/sanitization_filter_spec.rb) | 2 | ||||
-rw-r--r-- | spec/lib/banzai/filter/snippet_reference_filter_spec.rb (renamed from spec/lib/gitlab/markdown/filter/snippet_reference_filter_spec.rb) | 2 | ||||
-rw-r--r-- | spec/lib/banzai/filter/syntax_highlight_filter_spec.rb (renamed from spec/lib/gitlab/markdown/filter/syntax_highlight_filter_spec.rb) | 2 | ||||
-rw-r--r-- | spec/lib/banzai/filter/table_of_contents_filter_spec.rb (renamed from spec/lib/gitlab/markdown/filter/table_of_contents_filter_spec.rb) | 2 | ||||
-rw-r--r-- | spec/lib/banzai/filter/task_list_filter_spec.rb (renamed from spec/lib/gitlab/markdown/filter/task_list_filter_spec.rb) | 2 | ||||
-rw-r--r-- | spec/lib/banzai/filter/upload_link_filter_spec.rb (renamed from spec/lib/gitlab/markdown/filter/upload_link_filter_spec.rb) | 2 | ||||
-rw-r--r-- | spec/lib/banzai/filter/user_reference_filter_spec.rb (renamed from spec/lib/gitlab/markdown/filter/user_reference_filter_spec.rb) | 2 | ||||
-rw-r--r-- | spec/lib/gitlab/asciidoc_spec.rb | 2 | ||||
-rw-r--r-- | spec/support/filter_spec_helper.rb | 36 |
23 files changed, 40 insertions, 40 deletions
diff --git a/spec/benchmarks/lib/gitlab/markdown/reference_filter_spec.rb b/spec/benchmarks/lib/gitlab/markdown/reference_filter_spec.rb index 34cd9f7e4eb..3855763b200 100644 --- a/spec/benchmarks/lib/gitlab/markdown/reference_filter_spec.rb +++ b/spec/benchmarks/lib/gitlab/markdown/reference_filter_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Gitlab::Markdown::ReferenceFilter, benchmark: true do +describe Banzai::Filter::ReferenceFilter, benchmark: true do let(:input) do html = <<-EOF <p>Hello @alice and @bob, how are you doing today?</p> diff --git a/spec/lib/gitlab/markdown/cross_project_reference_spec.rb b/spec/lib/banzai/cross_project_reference_spec.rb index f594fe4ccf6..81b9a513ce3 100644 --- a/spec/lib/gitlab/markdown/cross_project_reference_spec.rb +++ b/spec/lib/banzai/cross_project_reference_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Gitlab::Markdown::CrossProjectReference, lib: true do +describe Banzai::CrossProjectReference, lib: true do include described_class describe '#project_from_ref' do diff --git a/spec/lib/gitlab/markdown/filter/autolink_filter_spec.rb b/spec/lib/banzai/filter/autolink_filter_spec.rb index a0844aee559..84c2ddf444e 100644 --- a/spec/lib/gitlab/markdown/filter/autolink_filter_spec.rb +++ b/spec/lib/banzai/filter/autolink_filter_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Gitlab::Markdown::AutolinkFilter, lib: true do +describe Banzai::Filter::AutolinkFilter, lib: true do include FilterSpecHelper let(:link) { 'http://about.gitlab.com/' } diff --git a/spec/lib/gitlab/markdown/filter/commit_range_reference_filter_spec.rb b/spec/lib/banzai/filter/commit_range_reference_filter_spec.rb index 570c9767628..c2a8ad36c30 100644 --- a/spec/lib/gitlab/markdown/filter/commit_range_reference_filter_spec.rb +++ b/spec/lib/banzai/filter/commit_range_reference_filter_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Gitlab::Markdown::CommitRangeReferenceFilter, lib: true do +describe Banzai::Filter::CommitRangeReferenceFilter, lib: true do include FilterSpecHelper let(:project) { create(:project, :public) } diff --git a/spec/lib/gitlab/markdown/filter/commit_reference_filter_spec.rb b/spec/lib/banzai/filter/commit_reference_filter_spec.rb index 76e7957bbb9..473534ba68a 100644 --- a/spec/lib/gitlab/markdown/filter/commit_reference_filter_spec.rb +++ b/spec/lib/banzai/filter/commit_reference_filter_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Gitlab::Markdown::CommitReferenceFilter, lib: true do +describe Banzai::Filter::CommitReferenceFilter, lib: true do include FilterSpecHelper let(:project) { create(:project, :public) } diff --git a/spec/lib/gitlab/markdown/filter/emoji_filter_spec.rb b/spec/lib/banzai/filter/emoji_filter_spec.rb index ea9b81862cf..cf314058158 100644 --- a/spec/lib/gitlab/markdown/filter/emoji_filter_spec.rb +++ b/spec/lib/banzai/filter/emoji_filter_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Gitlab::Markdown::EmojiFilter, lib: true do +describe Banzai::Filter::EmojiFilter, lib: true do include FilterSpecHelper before do diff --git a/spec/lib/gitlab/markdown/filter/external_issue_reference_filter_spec.rb b/spec/lib/banzai/filter/external_issue_reference_filter_spec.rb index d8420102648..953466679e4 100644 --- a/spec/lib/gitlab/markdown/filter/external_issue_reference_filter_spec.rb +++ b/spec/lib/banzai/filter/external_issue_reference_filter_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Gitlab::Markdown::ExternalIssueReferenceFilter, lib: true do +describe Banzai::Filter::ExternalIssueReferenceFilter, lib: true do include FilterSpecHelper def helper diff --git a/spec/lib/gitlab/markdown/filter/external_link_filter_spec.rb b/spec/lib/banzai/filter/external_link_filter_spec.rb index e559f5741cc..e3a8e15330e 100644 --- a/spec/lib/gitlab/markdown/filter/external_link_filter_spec.rb +++ b/spec/lib/banzai/filter/external_link_filter_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Gitlab::Markdown::ExternalLinkFilter, lib: true do +describe Banzai::Filter::ExternalLinkFilter, lib: true do include FilterSpecHelper it 'ignores elements without an href attribute' do diff --git a/spec/lib/gitlab/markdown/filter/issue_reference_filter_spec.rb b/spec/lib/banzai/filter/issue_reference_filter_spec.rb index 1aa5d44568e..5a0d3d577a8 100644 --- a/spec/lib/gitlab/markdown/filter/issue_reference_filter_spec.rb +++ b/spec/lib/banzai/filter/issue_reference_filter_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Gitlab::Markdown::IssueReferenceFilter, lib: true do +describe Banzai::Filter::IssueReferenceFilter, lib: true do include FilterSpecHelper def helper diff --git a/spec/lib/gitlab/markdown/filter/label_reference_filter_spec.rb b/spec/lib/banzai/filter/label_reference_filter_spec.rb index 4fcbb329fe4..b46ccc47605 100644 --- a/spec/lib/gitlab/markdown/filter/label_reference_filter_spec.rb +++ b/spec/lib/banzai/filter/label_reference_filter_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' require 'html/pipeline' -describe Gitlab::Markdown::LabelReferenceFilter, lib: true do +describe Banzai::Filter::LabelReferenceFilter, lib: true do include FilterSpecHelper let(:project) { create(:empty_project, :public) } diff --git a/spec/lib/gitlab/markdown/filter/merge_request_reference_filter_spec.rb b/spec/lib/banzai/filter/merge_request_reference_filter_spec.rb index 589550e15c4..352710df307 100644 --- a/spec/lib/gitlab/markdown/filter/merge_request_reference_filter_spec.rb +++ b/spec/lib/banzai/filter/merge_request_reference_filter_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Gitlab::Markdown::MergeRequestReferenceFilter, lib: true do +describe Banzai::Filter::MergeRequestReferenceFilter, lib: true do include FilterSpecHelper let(:project) { create(:project, :public) } diff --git a/spec/lib/gitlab/markdown/filter/redactor_filter_spec.rb b/spec/lib/banzai/filter/redactor_filter_spec.rb index 9e6ee9f0d61..e9bb388e361 100644 --- a/spec/lib/gitlab/markdown/filter/redactor_filter_spec.rb +++ b/spec/lib/banzai/filter/redactor_filter_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Gitlab::Markdown::RedactorFilter, lib: true do +describe Banzai::Filter::RedactorFilter, lib: true do include ActionView::Helpers::UrlHelper include FilterSpecHelper diff --git a/spec/lib/gitlab/markdown/filter/reference_gatherer_filter_spec.rb b/spec/lib/banzai/filter/reference_gatherer_filter_spec.rb index abfb5ad5e49..c8b1dfdf944 100644 --- a/spec/lib/gitlab/markdown/filter/reference_gatherer_filter_spec.rb +++ b/spec/lib/banzai/filter/reference_gatherer_filter_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Gitlab::Markdown::ReferenceGathererFilter, lib: true do +describe Banzai::Filter::ReferenceGathererFilter, lib: true do include ActionView::Helpers::UrlHelper include FilterSpecHelper diff --git a/spec/lib/gitlab/markdown/filter/relative_link_filter_spec.rb b/spec/lib/banzai/filter/relative_link_filter_spec.rb index e0f53e2a533..0b3e5ecbc9f 100644 --- a/spec/lib/gitlab/markdown/filter/relative_link_filter_spec.rb +++ b/spec/lib/banzai/filter/relative_link_filter_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Markdown::RelativeLinkFilter, lib: true do +describe Banzai::Filter::RelativeLinkFilter, lib: true do def filter(doc, contexts = {}) contexts.reverse_merge!({ commit: project.commit, diff --git a/spec/lib/gitlab/markdown/filter/sanitization_filter_spec.rb b/spec/lib/banzai/filter/sanitization_filter_spec.rb index a5e5ee0e08a..760d60a4190 100644 --- a/spec/lib/gitlab/markdown/filter/sanitization_filter_spec.rb +++ b/spec/lib/banzai/filter/sanitization_filter_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Gitlab::Markdown::SanitizationFilter, lib: true do +describe Banzai::Filter::SanitizationFilter, lib: true do include FilterSpecHelper describe 'default whitelist' do diff --git a/spec/lib/gitlab/markdown/filter/snippet_reference_filter_spec.rb b/spec/lib/banzai/filter/snippet_reference_filter_spec.rb index 51526b58597..26466fbb180 100644 --- a/spec/lib/gitlab/markdown/filter/snippet_reference_filter_spec.rb +++ b/spec/lib/banzai/filter/snippet_reference_filter_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Gitlab::Markdown::SnippetReferenceFilter, lib: true do +describe Banzai::Filter::SnippetReferenceFilter, lib: true do include FilterSpecHelper let(:project) { create(:empty_project, :public) } diff --git a/spec/lib/gitlab/markdown/filter/syntax_highlight_filter_spec.rb b/spec/lib/banzai/filter/syntax_highlight_filter_spec.rb index 8b76048f3e3..407617f3307 100644 --- a/spec/lib/gitlab/markdown/filter/syntax_highlight_filter_spec.rb +++ b/spec/lib/banzai/filter/syntax_highlight_filter_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Gitlab::Markdown::SyntaxHighlightFilter, lib: true do +describe Banzai::Filter::SyntaxHighlightFilter, lib: true do include FilterSpecHelper it 'highlights valid code blocks' do diff --git a/spec/lib/gitlab/markdown/filter/table_of_contents_filter_spec.rb b/spec/lib/banzai/filter/table_of_contents_filter_spec.rb index c8c79c41847..6a5d003e87f 100644 --- a/spec/lib/gitlab/markdown/filter/table_of_contents_filter_spec.rb +++ b/spec/lib/banzai/filter/table_of_contents_filter_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Markdown::TableOfContentsFilter, lib: true do +describe Banzai::Filter::TableOfContentsFilter, lib: true do include FilterSpecHelper def header(level, text) diff --git a/spec/lib/gitlab/markdown/filter/task_list_filter_spec.rb b/spec/lib/banzai/filter/task_list_filter_spec.rb index 1b1714ef882..f2e3a44478d 100644 --- a/spec/lib/gitlab/markdown/filter/task_list_filter_spec.rb +++ b/spec/lib/banzai/filter/task_list_filter_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Gitlab::Markdown::TaskListFilter, lib: true do +describe Banzai::Filter::TaskListFilter, lib: true do include FilterSpecHelper it 'does not apply `task-list` class to non-task lists' do diff --git a/spec/lib/gitlab/markdown/filter/upload_link_filter_spec.rb b/spec/lib/banzai/filter/upload_link_filter_spec.rb index 38a007b5bee..3b073a90a95 100644 --- a/spec/lib/gitlab/markdown/filter/upload_link_filter_spec.rb +++ b/spec/lib/banzai/filter/upload_link_filter_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Markdown::UploadLinkFilter, lib: true do +describe Banzai::Filter::UploadLinkFilter, lib: true do def filter(doc, contexts = {}) contexts.reverse_merge!({ project: project diff --git a/spec/lib/gitlab/markdown/filter/user_reference_filter_spec.rb b/spec/lib/banzai/filter/user_reference_filter_spec.rb index 277037cf68a..3534bf97784 100644 --- a/spec/lib/gitlab/markdown/filter/user_reference_filter_spec.rb +++ b/spec/lib/banzai/filter/user_reference_filter_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Gitlab::Markdown::UserReferenceFilter, lib: true do +describe Banzai::Filter::UserReferenceFilter, lib: true do include FilterSpecHelper let(:project) { create(:empty_project, :public) } diff --git a/spec/lib/gitlab/asciidoc_spec.rb b/spec/lib/gitlab/asciidoc_spec.rb index 3a860899e18..6beb21c6d2b 100644 --- a/spec/lib/gitlab/asciidoc_spec.rb +++ b/spec/lib/gitlab/asciidoc_spec.rb @@ -50,7 +50,7 @@ module Gitlab filtered_html = '<b>ASCII</b>' allow(Asciidoctor).to receive(:convert).and_return(html) - expect(Gitlab::Markdown).to receive(:render) + expect(Banzai).to receive(:render) .with(html, context.merge(pipeline: :asciidoc)) .and_return(filtered_html) diff --git a/spec/support/filter_spec_helper.rb b/spec/support/filter_spec_helper.rb index 91e3bee13c1..d6e03cbef3d 100644 --- a/spec/support/filter_spec_helper.rb +++ b/spec/support/filter_spec_helper.rb @@ -1,4 +1,4 @@ -# Helper methods for Gitlab::Markdown filter specs +# Helper methods for Banzai filter specs # # Must be included into specs manually module FilterSpecHelper @@ -10,49 +10,49 @@ module FilterSpecHelper # if none is provided. # # html - HTML String to pass to the filter's `call` method. - # contexts - Hash context for the filter. (default: {project: project}) + # context - Hash context for the filter. (default: {project: project}) # # Returns a Nokogiri::XML::DocumentFragment - def filter(html, contexts = {}) + def filter(html, context = {}) if defined?(project) - contexts.reverse_merge!(project: project) + context.reverse_merge!(project: project) end - described_class.call(html, contexts) + described_class.call(html, context) 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}) + # context - Hash context for the filter. (default: {project: project}) # # Returns the Hash - def pipeline_result(body, contexts = {}) - contexts.reverse_merge!(project: project) if defined?(project) + def pipeline_result(body, context = {}) + context.reverse_merge!(project: project) if defined?(project) - pipeline = HTML::Pipeline.new([described_class], contexts) + pipeline = HTML::Pipeline.new([described_class], context) pipeline.call(body) end - def reference_pipeline(contexts = {}) - contexts.reverse_merge!(project: project) if defined?(project) + def reference_pipeline(context = {}) + context.reverse_merge!(project: project) if defined?(project) filters = [ - Gitlab::Markdown::AutolinkFilter, + Banzai::Filter::AutolinkFilter, described_class, - Gitlab::Markdown::ReferenceGathererFilter + Banzai::Filter::ReferenceGathererFilter ] - HTML::Pipeline.new(filters, contexts) + HTML::Pipeline.new(filters, context) end - def reference_pipeline_result(body, contexts = {}) - reference_pipeline(contexts).call(body) + def reference_pipeline_result(body, context = {}) + reference_pipeline(context).call(body) end - def reference_filter(html, contexts = {}) - reference_pipeline(contexts).to_document(html) + def reference_filter(html, context = {}) + reference_pipeline(context).to_document(html) end # Modify a String reference to make it invalid |