From 068a1b972a67b912c0f2a47c0b0f41250ed8e299 Mon Sep 17 00:00:00 2001 From: Ben Balter Date: Sat, 20 Feb 2016 17:24:08 -0500 Subject: [PATCH] add tests --- spec/jekyll_seo_tag_spec.rb | 47 ++++++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 3 deletions(-) diff --git a/spec/jekyll_seo_tag_spec.rb b/spec/jekyll_seo_tag_spec.rb index 86e5ed9..8af81aa 100644 --- a/spec/jekyll_seo_tag_spec.rb +++ b/spec/jekyll_seo_tag_spec.rb @@ -173,7 +173,8 @@ describe Jekyll::SeoTag do context 'twitter' do context 'with site.twitter.username' do - let(:site) { make_site('twitter' => { 'username' => 'jekyllrb' }) } + let(:site_twitter) { { 'username' => 'jekyllrb' } } + let(:site) { make_site('twitter' => site_twitter) } context 'with page.author as a string' do let(:page) { make_page('author' => 'benbalter') } @@ -185,12 +186,52 @@ describe Jekyll::SeoTag do expected = %r{} expect(output).to match(expected) end + + context 'with an @' do + let(:page) { make_page('author' => '@benbalter') } + + it 'outputs the twitter card' do + expected = %r{} + expect(output).to match(expected) + end + end + + context 'with site.data.authors' do + let(:author_data) { {} } + let(:data) { { 'authors' => author_data } } + let(:site) { make_site('data' => data, 'twitter' => site_twitter) } + + context 'with the author in site.data.authors' do + let(:author_data) { { 'benbalter' => { 'twitter' => 'test' } } } + it 'outputs the twitter card' do + expected = %r{} + expect(output).to match(expected) + end + end + + context 'without the author in site.data.authors' do + it 'outputs the twitter card' do + expected = %r{} + expect(output).to match(expected) + end + end + end end - context 'with page.author as an object' do + context 'with page.author as a hash' do let(:page) { make_page('author' => { 'twitter' => '@test' }) } - it 'supports author data as an object' do + it 'supports author data as a hash' do + expected = %r{} + expect(output).to match(expected) + end + end + + context 'with site.author as a hash' do + let(:author) { { 'twitter' => '@test' } } + let(:site) { make_site('author' => author, 'twitter' => site_twitter) } + + it 'supports author data as an hash' do expected = %r{} expect(output).to match(expected) end