Add tests for large image Twitter card

This commit is contained in:
Bo Turnbow 2016-03-05 12:19:14 -08:00 committed by Pat Hawks
parent 2494901e64
commit ad5add0540
No known key found for this signature in database
GPG Key ID: F1746FF5F18B3D1B
2 changed files with 14 additions and 3 deletions

View File

@ -132,13 +132,12 @@
{% endif %}
{% if site.twitter %}
{% if page.image %}
{% if seo_page_image %}
<meta name="twitter:card" content="summary_large_image" />
{% else %}
<meta name="twitter:card" content="summary" />
{% endif %}
<meta name="twitter:site" content="@{{ site.twitter.username | replace:"@","" }}" />
{% if seo_author_twitter %}

View File

@ -203,6 +203,9 @@ EOS
let(:page) { make_page('author' => 'benbalter') }
it 'outputs twitter card meta' do
expected = %r{<meta name="twitter:card" content="summary" />}
expect(output).to match(expected)
expected = %r{<meta name="twitter:site" content="@jekyllrb" />}
expect(output).to match(expected)
@ -241,6 +244,15 @@ EOS
end
end
context 'with page.image' do
let(:page) { make_page('image' => '/img/foo.png') }
it 'outputs summary card with large image' do
expected = %r{<meta name="twitter:card" content="summary_large_image" />}
expect(output).to match(expected)
end
end
context 'with page.author as a hash' do
let(:page) { make_page('author' => { 'twitter' => '@test' }) }