spec/lib/onebox/engine/youtube_onebox_spec.rb in onebox-1.6.2 vs spec/lib/onebox/engine/youtube_onebox_spec.rb in onebox-1.6.3

- old
+ new

@@ -2,13 +2,14 @@ describe Onebox::Engine::YoutubeOnebox do before do fake("https://www.youtube.com/watch?feature=player_embedded&v=21Lk4YiASMo", response("youtube")) fake("https://youtu.be/21Lk4YiASMo", response("youtube")) - fake("http://www.youtube.com/oembed?format=json&url=http://www.youtube.com/watch?v=21Lk4YiASMo", response("youtube")) fake("https://www.youtube.com/channel/UCL8ZULXASCc1I_oaOT0NaOQ", response("youtube-channel")) fake("https://www.youtube.com/playlist?list=PL5308B2E5749D1696", response("youtube-playlist")) + fake("https://www.youtube.com/oembed?format=json&url=https://www.youtube.com/watch?v=21Lk4YiASMo", response("youtube-json")) + fake("https://www.youtube.com/oembed?format=json&url=https://www.youtube.com/playlist?list=PL5308B2E5749D1696", response("youtube-list-json")) end it "adds wmode=opaque" do expect(Onebox.preview('https://www.youtube.com/watch?v=21Lk4YiASMo').to_s).to match(/wmode=opaque/) end @@ -26,11 +27,13 @@ expect(Onebox.preview('https://www.youtube.com/channel/UCL8ZULXASCc1I_oaOT0NaOQ').to_s).to match(/Google Chrome/) end it "can onebox a playlist" do expect(Onebox.preview('https://www.youtube.com/playlist?list=PL5308B2E5749D1696').to_s).to match(/iframe/) - expect(Onebox.preview('https://www.youtube.com/playlist?list=PL5308B2E5749D1696').placeholder_html).to match(/<img/) + placeholder_html = Onebox.preview('https://www.youtube.com/playlist?list=PL5308B2E5749D1696').placeholder_html + expect(placeholder_html).to match(/<img/) + expect(placeholder_html).to include("The web is what you make of it") end it "does not make HTTP requests unless necessary" do # We haven't defined any fixture for requests associated with this ID, so if # any HTTP requests are made fakeweb will complain and the test will fail. @@ -70,7 +73,11 @@ it "permits looping videos" do preview = expect(Onebox.preview('https://www.youtube.com/watch?v=21Lk4YiASMo&loop').to_s) preview.to match(/loop=1/) preview.to match(/playlist=21Lk4YiASMo/) + end + + it "includes title in preview" do + expect(Onebox.preview("https://youtu.be/21Lk4YiASMo").placeholder_html).to include("96neko - orange") end end