Explicitly test both canonical URL cases

This commit is contained in:
Ben Balter 2017-05-25 09:33:03 -04:00 committed by GitHub
parent 83d7c3dd63
commit bf6b14b167
1 changed files with 6 additions and 3 deletions

View File

@ -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