dont use unless and else, per rubocop

This commit is contained in:
Ben Balter 2017-05-25 09:35:03 -04:00
parent 245abc6032
commit fb7a346b48
No known key found for this signature in database
GPG Key ID: DBB67C246AD356C4
2 changed files with 3 additions and 4 deletions

View File

@ -183,10 +183,10 @@ module Jekyll
def canonical_url
@canonical_url ||= begin
unless page["canonical_url"].to_s.empty?
page["canonical_url"]
else
if page["canonical_url"].to_s.empty?
filters.absolute_url(page["url"]).to_s.gsub(%r!/index\.html$!, "/")
else
page["canonical_url"]
end
end
end

View File

@ -638,7 +638,6 @@ RSpec.describe Jekyll::SeoTag::Drop do
end
context "when canonical url is not specified for a page" do
it "uses site specific canonical url" do
expect(subject.canonical_url).to eq("http://example.com/page.html")
end