Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--spec/lib/banzai/filter/wiki_link_filter_spec.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/spec/lib/banzai/filter/wiki_link_filter_spec.rb b/spec/lib/banzai/filter/wiki_link_filter_spec.rb
index 56b1a267390..185abbb2108 100644
--- a/spec/lib/banzai/filter/wiki_link_filter_spec.rb
+++ b/spec/lib/banzai/filter/wiki_link_filter_spec.rb
@@ -3,8 +3,8 @@ require 'spec_helper'
describe Banzai::Filter::WikiLinkFilter, lib: true do
include FilterSpecHelper
- let(:namespace) { build(:namespace, name: "wiki_link_ns") }
- let(:project) { build(:empty_project, :public, name: "wiki_link_project", namespace: namespace) }
+ let(:namespace) { build_stubbed(:namespace, name: "wiki_link_ns") }
+ let(:project) { build_stubbed(:empty_project, :public, name: "wiki_link_project", namespace: namespace) }
let(:user) { double }
let(:project_wiki) { ProjectWiki.new(project, user) }
@@ -13,12 +13,14 @@ describe Banzai::Filter::WikiLinkFilter, lib: true do
it "doesn't rewrite non-file links" do
link = "<a href='./page'>Link to Page</a>"
filtered_link = filter(link, project_wiki: project_wiki).children[0]
+
expect(filtered_link.attribute('href').value).to eq('./page')
end
it "doesn't rewrite file links" do
link = "<a href='./page.md'>Link to Page</a>"
filtered_link = filter(link, project_wiki: project_wiki).children[0]
+
expect(filtered_link.attribute('href').value).to eq('./page.md')
end
end
@@ -27,12 +29,14 @@ describe Banzai::Filter::WikiLinkFilter, lib: true do
it "doesn't rewrite non-file links" do
link = "<a href='../page'>Link to Page</a>"
filtered_link = filter(link, project_wiki: project_wiki).children[0]
+
expect(filtered_link.attribute('href').value).to eq('../page')
end
it "doesn't rewrite file links" do
link = "<a href='../page.md'>Link to Page</a>"
filtered_link = filter(link, project_wiki: project_wiki).children[0]
+
expect(filtered_link.attribute('href').value).to eq('../page.md')
end
end
@@ -41,12 +45,14 @@ describe Banzai::Filter::WikiLinkFilter, lib: true do
it "doesn't rewrite non-file links" do
link = "<a href='./subdirectory/page'>Link to Page</a>"
filtered_link = filter(link, project_wiki: project_wiki).children[0]
+
expect(filtered_link.attribute('href').value).to eq('./subdirectory/page')
end
it "doesn't rewrite file links" do
link = "<a href='./subdirectory/page.md'>Link to Page</a>"
filtered_link = filter(link, project_wiki: project_wiki).children[0]
+
expect(filtered_link.attribute('href').value).to eq('./subdirectory/page.md')
end
end
@@ -62,6 +68,7 @@ describe Banzai::Filter::WikiLinkFilter, lib: true do
it "doesn't rewrite file links" do
link = "<a href='page.md'>Link to Page</a>"
filtered_link = filter(link, project_wiki: project_wiki).children[0]
+
expect(filtered_link.attribute('href').value).to eq('page.md')
end
end
@@ -71,6 +78,7 @@ describe Banzai::Filter::WikiLinkFilter, lib: true do
it "doesn't rewrite links" do
link = "<a href='http://example.com/page'>Link to Page</a>"
filtered_link = filter(link, project_wiki: project_wiki).children[0]
+
expect(filtered_link.attribute('href').value).to eq('http://example.com/page')
end
end