onebox 1.8.15 → 1.8.16

Sign up to get free protection for your applications and to get access to all the features.
@@ -84,7 +84,7 @@ describe Onebox::Engine::WhitelistedGenericOnebox do
84
84
  end
85
85
 
86
86
  describe "cookie support" do
87
- let(:url) { "http://cookie-test.com" }
87
+ let(:url) { "http://www.dailymail.co.uk/news/article-479146/Brutality-justice-The-truth-tarred-feathered-drug-dealer.html" }
88
88
  before do
89
89
  fake(url, response('dailymail'))
90
90
  end
@@ -97,6 +97,23 @@ describe Onebox::Engine::WhitelistedGenericOnebox do
97
97
  end
98
98
  end
99
99
 
100
+ describe "uses canonical link" do
101
+ let(:mobile_url) { "http://m.imdb.com/title/tt0944947" }
102
+ let(:canonical_url) { "http://www.imdb.com/title/tt0944947/" }
103
+ before do
104
+ fake(mobile_url, response('imdb_mobile'))
105
+ fake(canonical_url, response('imdb'))
106
+ end
107
+
108
+ it 'fetches opengraph data from canonical link' do
109
+ onebox = described_class.new(mobile_url)
110
+ expect(onebox.to_html).not_to be_nil
111
+ expect(onebox.to_html).to include("Game of Thrones")
112
+ expect(onebox.to_html).to include("Nine noble families fight for control over the mythical lands of Westeros")
113
+ expect(onebox.to_html).to include("https://images-na.ssl-images-amazon.com/images/M/MV5BMjE3NTQ1NDg1Ml5BMl5BanBnXkFtZTgwNzY2NDA0MjI@._V1_UY1200_CR90,0,630,1200_AL_.jpg")
114
+ end
115
+ end
116
+
100
117
  describe 'to_html' do
101
118
  after(:each) do
102
119
  Onebox.options = Onebox::DEFAULTS
@@ -5,6 +5,7 @@ describe Onebox::Engine::YoutubeOnebox do
5
5
  fake("https://www.youtube.com/watch?feature=player_embedded&v=21Lk4YiASMo", response("youtube"))
6
6
  fake("https://youtu.be/21Lk4YiASMo", response("youtube"))
7
7
  fake("https://www.youtube.com/channel/UCL8ZULXASCc1I_oaOT0NaOQ", response("youtube-channel"))
8
+ fake("http://www.youtube.com/user/googlechrome", response("youtube-channel"))
8
9
  fake("https://www.youtube.com/playlist?list=PL5308B2E5749D1696", response("youtube-playlist"))
9
10
  fake("https://www.youtube.com/oembed?format=json&url=https://www.youtube.com/watch?v=21Lk4YiASMo", response("youtube-json"))
10
11
  fake("https://www.youtube.com/oembed?format=json&url=https://www.youtube.com/playlist?list=PL5308B2E5749D1696", response("youtube-list-json"))
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onebox
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.15
4
+ version: 1.8.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joanna Zeta
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-07-10 00:00:00.000000000 Z
13
+ date: 2017-07-20 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: multi_json
@@ -405,6 +405,8 @@ files:
405
405
  - spec/fixtures/githubpullrequest.response
406
406
  - spec/fixtures/googleplayapp.response
407
407
  - spec/fixtures/image.response
408
+ - spec/fixtures/imdb.response
409
+ - spec/fixtures/imdb_mobile.response
408
410
  - spec/fixtures/meetup.response.html
409
411
  - spec/fixtures/meetup_oembed.response
410
412
  - spec/fixtures/pubmed-electronic-xml.response
@@ -526,6 +528,8 @@ test_files:
526
528
  - spec/fixtures/githubpullrequest.response
527
529
  - spec/fixtures/googleplayapp.response
528
530
  - spec/fixtures/image.response
531
+ - spec/fixtures/imdb.response
532
+ - spec/fixtures/imdb_mobile.response
529
533
  - spec/fixtures/meetup.response.html
530
534
  - spec/fixtures/meetup_oembed.response
531
535
  - spec/fixtures/pubmed-electronic-xml.response