Explicitly test both canonical URL cases
This commit is contained in:
parent
83d7c3dd63
commit
bf6b14b167
|
@ -626,18 +626,21 @@ RSpec.describe Jekyll::SeoTag::Drop do
|
|||
end
|
||||
|
||||
context "canonical url" do
|
||||
let(:config) { { :url => "http://example.com" } }
|
||||
|
||||
context "when canonical url is specified for a page" do
|
||||
let(:page) { make_page({ "title" => "page title", "canonical_url" => "https://github.com/jekyll/jekyll-seo-tag/" }) }
|
||||
let(:canonical_url) { "https://github.com/jekyll/jekyll-seo-tag/" }
|
||||
let(:page_meta) { { "title" => "page title", "canonical_url" => canonical_url } }
|
||||
|
||||
it "uses specified canonical url" do
|
||||
expect(subject.canonical_url).to eq(canonical_url)
|
||||
end
|
||||
end
|
||||
|
||||
context "when canonical url is not specified for a page" do
|
||||
let(:canonical_url) { "https://github.com/jekyll/jekyll-seo-tag/" }
|
||||
|
||||
it "uses site specific canonical url" do
|
||||
expect(subject.canonical_url).not_to eq(canonical_url)
|
||||
expect(subject.canonical_url).to eq("http://example.com/page-title.html")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue