From 2191a550eee4037be44c13b761bc4b2cff1b9643 Mon Sep 17 00:00:00 2001 From: Aaron Gustafson Date: Fri, 31 Mar 2017 14:41:46 -0400 Subject: [PATCH] Test cleanup --- lib/template.html | 8 ++------ spec/jekyll_seo_tag_spec.rb | 23 +++++++++++++++-------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/lib/template.html b/lib/template.html index 50488b1..8ce8a9e 100755 --- a/lib/template.html +++ b/lib/template.html @@ -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 %} {{ seo_title }} @@ -113,9 +111,7 @@ {% endif %} -{% if seo_page_locale %} - -{% endif %} + {% if seo_description %} diff --git a/spec/jekyll_seo_tag_spec.rb b/spec/jekyll_seo_tag_spec.rb index 700f524..38a020d 100755 --- a/spec/jekyll_seo_tag_spec.rb +++ b/spec/jekyll_seo_tag_spec.rb @@ -257,6 +257,7 @@ describe Jekyll::SeoTag do 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!! 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!! + + it "uses site.locale if page.locale is not present" do + expected = %r!! 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!! + expect(output).to match(expected) + end + end end end