From f8800e5286c71a85df77589dfb7ab79b9a0028c5 Mon Sep 17 00:00:00 2001 From: Tsukasa Setoguchi Date: Sun, 13 May 2018 05:01:45 +0900 Subject: [PATCH] add tests for twitter.card types (#289) Merge pull request 289 --- spec/jekyll_seo_tag_integration_spec.rb | 31 +++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/spec/jekyll_seo_tag_integration_spec.rb b/spec/jekyll_seo_tag_integration_spec.rb index bfd8bb4..8c63c79 100755 --- a/spec/jekyll_seo_tag_integration_spec.rb +++ b/spec/jekyll_seo_tag_integration_spec.rb @@ -424,11 +424,34 @@ EOS end context "with page.image" do - let(:page) { make_page("image" => "/img/foo.png") } + context "without *.twitter.card" do + let(:page) { make_page("image" => "/img/foo.png") } - it "outputs summary card with large image" do - expected = %r!! - expect(output).to match(expected) + it "outputs summary card with large image" do + expected = %r!! + expect(output).to match(expected) + end + end + + context "with page.twitter.card" do + let(:page_twitter) { { "card" => "summary" } } + let(:page) { make_page("image" => "/img/foo.png", "twitter" => page_twitter) } + + it "outputs summary card with small image" do + expected = %r!! + expect(output).to match(expected) + end + end + + context "with site.twitter.card" do + let(:site_twitter) { { "username" => "jekyllrb", "card" => "summary" } } + let(:site) { make_site("twitter" => site_twitter) } + let(:page) { make_page("image" => "/img/foo.png") } + + it "outputs summary card with small image" do + expected = %r!! + expect(output).to match(expected) + end end end