add tests
This commit is contained in:
parent
bc15a3a075
commit
cb81364a77
|
@ -110,7 +110,7 @@ describe Jekyll::SeoTag do
|
|||
end
|
||||
end
|
||||
|
||||
context 'with page.image' do
|
||||
context 'with page.image as a string' do
|
||||
let(:page) { make_page('image' => '/img/foo.png') }
|
||||
|
||||
it 'outputs the image' do
|
||||
|
@ -119,6 +119,47 @@ describe Jekyll::SeoTag do
|
|||
end
|
||||
end
|
||||
|
||||
context 'with page.image as an object' do
|
||||
context 'when given a path' do
|
||||
let(:page) { make_page('image' => { 'path' => '/img/foo.png' } ) }
|
||||
|
||||
it 'outputs the image' do
|
||||
expected = %r{<meta property="og:image" content="http://example.invalid/img/foo.png" />}
|
||||
expect(output).to match(expected)
|
||||
end
|
||||
end
|
||||
|
||||
context "when given a facebook image" do
|
||||
let(:page) { make_page('image' => { 'facebook' => '/img/facebook.png' } ) }
|
||||
|
||||
it 'outputs the image' do
|
||||
expected = %r{<meta property="og:image" content="http://example.invalid/img/facebook.png" />}
|
||||
expect(output).to match(expected)
|
||||
end
|
||||
end
|
||||
|
||||
context "when given a twitter image" do
|
||||
let(:page) { make_page('image' => { 'twitter' => '/img/twitter.png' } ) }
|
||||
|
||||
it 'outputs the image' do
|
||||
expected = %r{<meta name="twitter:image" content="http://example.invalid/img/twitter.png" />}
|
||||
expect(output).to match(expected)
|
||||
end
|
||||
end
|
||||
|
||||
context "when given the image height and width" do
|
||||
let(:image) { { 'facebook' => '/img/foo.png', 'height' => 1, 'width' => 2 } }
|
||||
let(:page) { make_page('image' => image) }
|
||||
|
||||
it 'outputs the image' do
|
||||
expected = %r{<meta property="og:image:height" content="1" />}
|
||||
expect(output).to match(expected)
|
||||
expected = %r{<meta property="og:image:width" content="2" />}
|
||||
expect(output).to match(expected)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'with site.logo' do
|
||||
let(:site) { make_site('logo' => '/logo.png', 'url' => 'http://example.invalid') }
|
||||
|
||||
|
|
Loading…
Reference in New Issue