test/test_picture.rb in jekyll-bits-0.9.3 vs test/test_picture.rb in jekyll-bits-0.10

- old
+ new

@@ -45,10 +45,21 @@ ) assert_match(/meta/, html) assert_match(/img2\.png/, html) end + def test_calculates_image_size + html = JbBox.new.jb_picture_head( + 'jb_picture' => { + 'src' => 'http://www.yegor256.com/images/2017/02/the-deer-hunter.jpg' + } + ) + assert_match(/meta/, html) + assert_contains("<meta name='og:image:width' content='1280'/>", html) + assert_contains("<meta name='og:image:height' content='543'/>", html) + end + def test_generates_html_simple_body html = JbBox.new.jb_picture_body('jb_picture' => '/img1.png') assert_match(/img/, html) assert_match(/figure/, html) end @@ -66,8 +77,14 @@ assert_match(/figcaption/, html) assert_match(/figure/, html) assert_match(/<figcaption id='79535e1e'>it is &lt;simple&gt;/, html) assert_match(/alt='nothing &#39;to&#39; say'/, html) assert_match(/width='500'/, html) + end + + private + + def assert_contains(substring, string, *args) + assert(string.include?(substring), *args) end end end