Skip to content

Commit

Permalink
Add test for multiple images attributes.
Browse files Browse the repository at this point in the history
  • Loading branch information
jcouture committed Sep 9, 2017
1 parent d4572d0 commit fd47481
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
16 changes: 16 additions & 0 deletions spec/lib/open_graph_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,5 +91,21 @@
expect(open_graph.videos[0].height).to eql('300')
end
end

context 'with multiples image attributes' do
it 'should create a proper OpenGraph object' do
content = File.read("#{File.dirname(__FILE__)}/../view/multiple_images_attributes.html")
open_graph = OGP::OpenGraph.new(content)

expect(open_graph.images[0].url).to eql('http://example.com/ogp1.jpg')
expect(open_graph.images[0].type).to eql('image/jpeg')
expect(open_graph.images[0].width).to eql('400')
expect(open_graph.images[0].height).to eql('300')
expect(open_graph.images[1].url).to eql('http://example.com/ogp2.jpg')
expect(open_graph.images[1].type).to eql('image/jpeg')
expect(open_graph.images[1].width).to eql('600')
expect(open_graph.images[1].height).to eql('500')
end
end
end
end
19 changes: 19 additions & 0 deletions spec/view/multiple_images_attributes.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta content="The Rock" property="og:title">
<meta content="video.movie" property="og:type">
<meta content="http://www.imdb.com/title/tt0117500/" property="og:url">
<meta content="http://example.com/ogp1.jpg" property="og:image">
<meta content="image/jpeg" property="og:image:type">
<meta content="400" property="og:image:width">
<meta content="300" property="og:image:height">
<meta content="http://example.com/ogp2.jpg" property="og:image">
<meta content="image/jpeg" property="og:image:type">
<meta content="600" property="og:image:width">
<meta content="500" property="og:image:height">
<title></title>
</head>
<body>
</body>
</html>

0 comments on commit fd47481

Please sign in to comment.