Test cleanup

This commit is contained in:
Aaron Gustafson 2017-03-31 14:41:46 -04:00
parent 179530d885
commit 2191a550ee
2 changed files with 17 additions and 14 deletions

View File

@ -97,9 +97,7 @@
{% assign seo_page_image = seo_page_image | escape %}
{% endif %}
{% if site.locale %}
{% assign seo_page_locale = page.locale | default: site.locale %}
{% endif %}
{% assign seo_page_locale = page.locale | default: site.locale | default: "en_US"" %}
{% if seo_tag.title and seo_title %}
<title>{{ seo_title }}</title>
@ -113,9 +111,7 @@
<meta name="author" content="{{ seo_author_name }}" />
{% endif %}
{% if seo_page_locale %}
<meta name="og:locale" content="{{ seo_page_locale }}" />
{% endif %}
<meta property="og:locale" content="{{ seo_page_locale }}" />
{% if seo_description %}
<meta name="description" content="{{ seo_description }}" />

View File

@ -257,6 +257,7 @@ describe Jekyll::SeoTag do
<!-- Begin Jekyll SEO tag v#{version} -->
<title>Foo</title>
<meta property="og:title" content="Foo" />
<meta property="og:locale" content="en_US" />
<link rel="canonical" href="http://example.invalid/page.html" />
<meta property="og:url" content="http://example.invalid/page.html" />
<meta property="og:site_name" content="Foo" />
@ -583,21 +584,27 @@ EOS
end
context "with locale" do
let(:site) { make_site("locale" => "en_US") }
it "uses site.locale if page.locale is not present" do
it "uses en_US when no locale is specified" do
expected = %r!<meta property="og:locale" content="en_US" />!
expect(output).to match(expected)
end
context "with page.locale" do
context "with site.locale" do
let(:site) { make_site("locale" => "en_US") }
let(:page) { make_page("locale" => "en_UK") }
it "uses page.locale if both site.locale and page.locale are present" do
expected = %r!<meta property="og:locale" content="en_UK" />!
it "uses site.locale if page.locale is not present" do
expected = %r!<meta property="og:locale" content="en_US" />!
expect(output).to match(expected)
end
context "with page.locale" do
let(:page) { make_page("locale" => "en_UK") }
it "uses page.locale if both site.locale and page.locale are present" do
expected = %r!<meta property="og:locale" content="en_UK" />!
expect(output).to match(expected)
end
end
end
end