onebox 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.rspec +1 -0
- data/.rubocop.yml +476 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +3 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +92 -0
- data/Rakefile +22 -0
- data/lib/onebox.rb +33 -0
- data/lib/onebox/engine.rb +93 -0
- data/lib/onebox/engine/amazon_onebox.rb +25 -0
- data/lib/onebox/engine/bliptv_onebox.rb +26 -0
- data/lib/onebox/engine/clikthrough_onebox.rb +23 -0
- data/lib/onebox/engine/college_humor_onebox.rb +26 -0
- data/lib/onebox/engine/dailymotion_onebox.rb +26 -0
- data/lib/onebox/engine/dotsub_onebox.rb +25 -0
- data/lib/onebox/engine/example_onebox.rb +25 -0
- data/lib/onebox/engine/flickr_onebox.rb +25 -0
- data/lib/onebox/engine/funny_or_die_onebox.rb +26 -0
- data/lib/onebox/engine/html.rb +11 -0
- data/lib/onebox/engine/hulu_onebox.rb +26 -0
- data/lib/onebox/engine/nfb_onebox.rb +25 -0
- data/lib/onebox/engine/open_graph.rb +11 -0
- data/lib/onebox/engine/qik_onebox.rb +23 -0
- data/lib/onebox/engine/revision3_onebox.rb +26 -0
- data/lib/onebox/engine/slideshare_onebox.rb +25 -0
- data/lib/onebox/engine/sound_cloud_onebox.rb +25 -0
- data/lib/onebox/engine/stack_exchange_onebox.rb +23 -0
- data/lib/onebox/engine/ted_onebox.rb +25 -0
- data/lib/onebox/engine/viddler_onebox.rb +26 -0
- data/lib/onebox/engine/vimeo_onebox.rb +26 -0
- data/lib/onebox/engine/wikipedia_onebox.rb +24 -0
- data/lib/onebox/engine/yfrog_onebox.rb +25 -0
- data/lib/onebox/matcher.rb +13 -0
- data/lib/onebox/preview.rb +31 -0
- data/lib/onebox/version.rb +3 -0
- data/onebox.gemspec +36 -0
- data/spec/fixtures/amazon.response +3098 -0
- data/spec/fixtures/android.response +138 -0
- data/spec/fixtures/apple.response +391 -0
- data/spec/fixtures/bliptv.response +724 -0
- data/spec/fixtures/clickthrough.response +1472 -0
- data/spec/fixtures/clikthrough.response +1472 -0
- data/spec/fixtures/collegehumor.response +1272 -0
- data/spec/fixtures/dailymotion.response +575 -0
- data/spec/fixtures/dotsub.response +1257 -0
- data/spec/fixtures/example.response +50 -0
- data/spec/fixtures/flickr.response +1292 -0
- data/spec/fixtures/funnyordie.response +2010 -0
- data/spec/fixtures/gist.response +282 -0
- data/spec/fixtures/github_blob.response +706 -0
- data/spec/fixtures/github_commit.response +881 -0
- data/spec/fixtures/github_pullrequest.response +1619 -0
- data/spec/fixtures/hulu.response +339 -0
- data/spec/fixtures/image.response +0 -0
- data/spec/fixtures/imgur.response +892 -0
- data/spec/fixtures/kinomap.response +299 -0
- data/spec/fixtures/nfb.response +810 -0
- data/spec/fixtures/opengraph.response +27 -0
- data/spec/fixtures/qik.response +371 -0
- data/spec/fixtures/revision3.response +985 -0
- data/spec/fixtures/rottentomatoes_fresh.response +3275 -0
- data/spec/fixtures/rottentomatoes_incomplete.response +2313 -0
- data/spec/fixtures/rottentomatoes_rotten.response +3549 -0
- data/spec/fixtures/slideshare.response +1745 -0
- data/spec/fixtures/soundcloud.response +1409 -0
- data/spec/fixtures/stackexchange.response +1889 -0
- data/spec/fixtures/ted.response +1341 -0
- data/spec/fixtures/twitter.response +1712 -0
- data/spec/fixtures/viddler.response +442 -0
- data/spec/fixtures/video.response +0 -0
- data/spec/fixtures/vimeo.response +571 -0
- data/spec/fixtures/wikipedia.response +1236 -0
- data/spec/fixtures/wikipedia_redirected.response +899 -0
- data/spec/fixtures/yfrog.response +464 -0
- data/spec/lib/onebox/engine/amazon_spec.rb +34 -0
- data/spec/lib/onebox/engine/bliptv_spec.rb +34 -0
- data/spec/lib/onebox/engine/clikthrough_spec.rb +26 -0
- data/spec/lib/onebox/engine/college_humor_spec.rb +34 -0
- data/spec/lib/onebox/engine/dailymotion_spec.rb +36 -0
- data/spec/lib/onebox/engine/dotsub_spec.rb +36 -0
- data/spec/lib/onebox/engine/example_spec.rb +18 -0
- data/spec/lib/onebox/engine/flickr_spec.rb +30 -0
- data/spec/lib/onebox/engine/funny_or_die_spec.rb +34 -0
- data/spec/lib/onebox/engine/hulu_spec.rb +34 -0
- data/spec/lib/onebox/engine/nfb_spec.rb +35 -0
- data/spec/lib/onebox/engine/qik_spec.rb +35 -0
- data/spec/lib/onebox/engine/revision3_spec.rb +36 -0
- data/spec/lib/onebox/engine/slideshare_spec.rb +30 -0
- data/spec/lib/onebox/engine/sound_cloud_spec.rb +36 -0
- data/spec/lib/onebox/engine/stack_exchange_spec.rb +27 -0
- data/spec/lib/onebox/engine/ted_spec.rb +30 -0
- data/spec/lib/onebox/engine/viddler_spec.rb +36 -0
- data/spec/lib/onebox/engine/vimeo_spec.rb +34 -0
- data/spec/lib/onebox/engine/wikipedia_spec.rb +30 -0
- data/spec/lib/onebox/engine/yfrog_spec.rb +30 -0
- data/spec/lib/onebox/engine_spec.rb +78 -0
- data/spec/lib/onebox/matcher_spec.rb +20 -0
- data/spec/lib/onebox/preview_spec.rb +21 -0
- data/spec/lib/onebox_spec.rb +49 -0
- data/spec/spec_helper.rb +26 -0
- data/spec/support/html_spec_helper.rb +17 -0
- data/templates/amazon.handlebars +9 -0
- data/templates/bliptv.handlebars +10 -0
- data/templates/clickthrough.handlebars +8 -0
- data/templates/clikthrough.handlebars +8 -0
- data/templates/collegehumor.handlebars +9 -0
- data/templates/dailymotion.handlebars +9 -0
- data/templates/dotsub.handlebars +9 -0
- data/templates/flickr.handlebars +8 -0
- data/templates/funnyordie.handlebars +9 -0
- data/templates/hulu.handlebars +9 -0
- data/templates/nfb.handlebars +8 -0
- data/templates/qik.handlebars +7 -0
- data/templates/revision3.handlebars +9 -0
- data/templates/slideshare.handlebars +8 -0
- data/templates/soundcloud.handlebars +9 -0
- data/templates/stackexchange.handlebars +7 -0
- data/templates/ted.handlebars +8 -0
- data/templates/viddler.handlebars +9 -0
- data/templates/vimeo.handlebars +9 -0
- data/templates/wikipedia.handlebars +8 -0
- data/templates/yfrog.handlebars +8 -0
- metadata +447 -0
@@ -0,0 +1,34 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Onebox::Engine::AmazonOnebox do
|
4
|
+
let(:link) { "http://amazon.com" }
|
5
|
+
before do
|
6
|
+
fake(link, response("amazon.response"))
|
7
|
+
end
|
8
|
+
|
9
|
+
it_behaves_like "engines"
|
10
|
+
|
11
|
+
describe "#to_html" do
|
12
|
+
let(:html) { described_class.new(link).to_html }
|
13
|
+
|
14
|
+
it "returns the product title" do
|
15
|
+
expect(html).to include("Knit Noro: Accessories: 30 Colorful Little Knits [Hardcover]")
|
16
|
+
end
|
17
|
+
|
18
|
+
it "returns the product image" do
|
19
|
+
expect(html).to include("61mI3YmHVnL._BO2,204,203,200_PIsitb-sticker-arrow-click,TopRight,35,-76_AA300_SH20_OU01_.jpg")
|
20
|
+
end
|
21
|
+
|
22
|
+
it "returns the product description" do
|
23
|
+
expect(html).to include("Using only the finest natural materials and ecologically sound")
|
24
|
+
end
|
25
|
+
|
26
|
+
it "returns the product price" do
|
27
|
+
expect(html).to include("$18.77")
|
28
|
+
end
|
29
|
+
|
30
|
+
it "returns the product URL" do
|
31
|
+
expect(html).to include(link)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Onebox::Engine::BliptvOnebox do
|
4
|
+
let(:link) { "http://blip.tv" }
|
5
|
+
before do
|
6
|
+
fake(link, response("bliptv.response"))
|
7
|
+
end
|
8
|
+
|
9
|
+
it_behaves_like "engines"
|
10
|
+
|
11
|
+
describe "#to_html" do
|
12
|
+
let(:html) { described_class.new(link).to_html }
|
13
|
+
|
14
|
+
it "returns video title" do
|
15
|
+
expect(html).to include("SC2L Week 3 - Axiom vs Acer G6")
|
16
|
+
end
|
17
|
+
|
18
|
+
it "returns image" do
|
19
|
+
expect(html).to include("Striderdoom-SC2LWeek3AxiomVsAcerG6178-416.jpg")
|
20
|
+
end
|
21
|
+
|
22
|
+
it "returns video description" do
|
23
|
+
expect(html).to include("Acer and Axiom go head to head in week 3!")
|
24
|
+
end
|
25
|
+
|
26
|
+
it "returns video" do
|
27
|
+
expect(html).to include("http://blip.tv/day9tv/sc2l-week-3-axiom-vs-acer-g6-6623829")
|
28
|
+
end
|
29
|
+
|
30
|
+
it "returns URL" do
|
31
|
+
expect(html).to include(link)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Onebox::Engine::ClikThroughOnebox do
|
4
|
+
let(:link) { "http://www.clickthough.com"}
|
5
|
+
before do
|
6
|
+
fake(link, response("clikthrough.response"))
|
7
|
+
end
|
8
|
+
|
9
|
+
it_behaves_like "engines"
|
10
|
+
|
11
|
+
describe "#to_html" do
|
12
|
+
let(:html) { described_class.new(link).to_html }
|
13
|
+
|
14
|
+
it "returns video title" do
|
15
|
+
expect(html).to include("Keri Hilson - Knock You Down")
|
16
|
+
end
|
17
|
+
|
18
|
+
it "returns video description" do
|
19
|
+
expect(html).to include("Keri Hilson gets taken down by love once again")
|
20
|
+
end
|
21
|
+
|
22
|
+
it "returns URL" do
|
23
|
+
expect(html).to include(link)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Onebox::Engine::CollegeHumorOnebox do
|
4
|
+
let(:link) { "http://collegehumor.com" }
|
5
|
+
before do
|
6
|
+
fake(link, response("collegehumor.response"))
|
7
|
+
end
|
8
|
+
|
9
|
+
it_behaves_like "engines"
|
10
|
+
|
11
|
+
describe "#to_html" do
|
12
|
+
let(:html) { described_class.new(link).to_html }
|
13
|
+
|
14
|
+
it "returns video title" do
|
15
|
+
expect(html).to include("Mitt Romney Style (Gangnam Style Parody)")
|
16
|
+
end
|
17
|
+
|
18
|
+
it "returns video image" do
|
19
|
+
expect(html).to include("a9febe641d5beb264bbab0de49272e5a-mitt-romney-style-gangnam-style-parody.jpg")
|
20
|
+
end
|
21
|
+
|
22
|
+
it "returns video description" do
|
23
|
+
expect(html).to include("Heyyy wealthy ladies!"Mitt Romney Style" is now available on iTunes")
|
24
|
+
end
|
25
|
+
|
26
|
+
it "returns video URL" do
|
27
|
+
expect(html).to include("moogaloop.1.0.31.swf?clip_id=6830834&use_node_id=true&og=1&auto=true")
|
28
|
+
end
|
29
|
+
|
30
|
+
it "returns URL" do
|
31
|
+
expect(html).to include(link)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Onebox::Engine::DailymotionOnebox do
|
4
|
+
let(:link) { "http://dailymotion.com" }
|
5
|
+
before do
|
6
|
+
fake(link, response("dailymotion.response"))
|
7
|
+
end
|
8
|
+
|
9
|
+
it_behaves_like "engines"
|
10
|
+
|
11
|
+
describe "#to_html" do
|
12
|
+
let(:html) { described_class.new(link).to_html }
|
13
|
+
|
14
|
+
it "returns video title" do
|
15
|
+
expect(html).to include("Two Door Cinema Club - Les Vielles Charrues 2013.")
|
16
|
+
end
|
17
|
+
|
18
|
+
it "returns video image" do
|
19
|
+
expect(html).to include("526x297-bxE.jpg")
|
20
|
+
end
|
21
|
+
|
22
|
+
it "returns video description" do
|
23
|
+
expect(html).to include("Vibrez au son de l'electro-pop des Irlandais de Two Door Cinema Club,")
|
24
|
+
end
|
25
|
+
|
26
|
+
it "returns video URL" do
|
27
|
+
expect(html).to include("http://www.dailymotion.com/swf/video/x12h020?autoPlay=1")
|
28
|
+
end
|
29
|
+
|
30
|
+
it "returns video embed code"
|
31
|
+
|
32
|
+
it "returns URL" do
|
33
|
+
expect(html).to include(link)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Onebox::Engine::DotsubOnebox do
|
4
|
+
let(:link) { "http://dotsub.com/view/665bd0d5-a9f4-4a07-9d9e-b31ba926ca78" }
|
5
|
+
before do
|
6
|
+
fake(link, response("dotsub.response"))
|
7
|
+
end
|
8
|
+
|
9
|
+
it_behaves_like "engines"
|
10
|
+
|
11
|
+
describe "#to_html" do
|
12
|
+
let(:html) { described_class.new(link).to_html }
|
13
|
+
|
14
|
+
it "returns video title" do
|
15
|
+
expect(html).to include("Twitter in Plain English")
|
16
|
+
end
|
17
|
+
|
18
|
+
it "returns video description" do
|
19
|
+
# og:decription tag spelled wrong in http response
|
20
|
+
pending
|
21
|
+
expect(html).to include("A short explanation of the micro-blogging service, Twitter.")
|
22
|
+
end
|
23
|
+
|
24
|
+
it "returns video photo" do
|
25
|
+
expect(html).to include("/665bd0d5-a9f4-4a07-9d9e-b31ba926ca78/p")
|
26
|
+
end
|
27
|
+
|
28
|
+
it "returns video URL" do
|
29
|
+
expect(html).to include("dotsub.com/media/665bd0d5-a9f4-4a07-9d9e-b31ba926ca78/m/flv/")
|
30
|
+
end
|
31
|
+
|
32
|
+
it "returns URL" do
|
33
|
+
expect(html).to include("http://dotsub.com/view/665bd0d5-a9f4-4a07-9d9e-b31ba926ca78")
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Onebox::Engine::ExampleOnebox do
|
4
|
+
let(:link) { "http://example.com" }
|
5
|
+
before do
|
6
|
+
fake(link, response("example.response"))
|
7
|
+
end
|
8
|
+
|
9
|
+
it_behaves_like "engines"
|
10
|
+
|
11
|
+
describe "#to_html" do
|
12
|
+
let(:html) { described_class.new(link).to_html }
|
13
|
+
|
14
|
+
it "returns template if given valid data" do
|
15
|
+
expect(html).to include(onebox_view("Example Domain 1"))
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Onebox::Engine::FlickrOnebox do
|
4
|
+
let(:link) { "http://flickr.com" }
|
5
|
+
before do
|
6
|
+
fake(link, response("flickr.response"))
|
7
|
+
end
|
8
|
+
|
9
|
+
it_behaves_like "engines"
|
10
|
+
|
11
|
+
describe "#to_html" do
|
12
|
+
let(:html) { described_class.new(link).to_html }
|
13
|
+
|
14
|
+
it "returns photo title" do
|
15
|
+
expect(html).to include("Los Angeles View 2011")
|
16
|
+
end
|
17
|
+
|
18
|
+
it "returns photo" do
|
19
|
+
expect(html).to include("6038315155_2875860c4b_z.jpg")
|
20
|
+
end
|
21
|
+
|
22
|
+
it "returns photo description" do
|
23
|
+
expect(html).to include("The view from the Griffith Observatory, Los Angeles; July 2011")
|
24
|
+
end
|
25
|
+
|
26
|
+
it "returns URL" do
|
27
|
+
expect(html).to include(link)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Onebox::Engine::FunnyOrDieOnebox do
|
4
|
+
let(:link) { "http://funnyordie.com" }
|
5
|
+
before do
|
6
|
+
fake(link, response("funnyordie.response"))
|
7
|
+
end
|
8
|
+
|
9
|
+
it_behaves_like "engines"
|
10
|
+
|
11
|
+
describe "#to_html" do
|
12
|
+
let(:html) { described_class.new(link).to_html }
|
13
|
+
|
14
|
+
it "returns video title" do
|
15
|
+
expect(html).to include("The Landlord")
|
16
|
+
end
|
17
|
+
|
18
|
+
it "returns video photo" do
|
19
|
+
expect(html).to include("c480x270_18.jpg")
|
20
|
+
end
|
21
|
+
|
22
|
+
it "returns video description" do
|
23
|
+
expect(html).to include("Will Ferrell meets his landlord.")
|
24
|
+
end
|
25
|
+
|
26
|
+
it "returns video URL" do
|
27
|
+
expect(html).to include("http://www.funnyordie.com/videos/74/the-landlord-from-will-ferrell-and-adam-ghost-panther-mckay")
|
28
|
+
end
|
29
|
+
|
30
|
+
it "returns URL" do
|
31
|
+
expect(html).to include(link)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Onebox::Engine::HuluOnebox do
|
4
|
+
let(:link) { "http://hulu.com" }
|
5
|
+
before do
|
6
|
+
fake(link, response("hulu.response"))
|
7
|
+
end
|
8
|
+
|
9
|
+
it_behaves_like "engines"
|
10
|
+
|
11
|
+
describe "#to_html" do
|
12
|
+
let(:html) { described_class.new(link).to_html }
|
13
|
+
|
14
|
+
it "returns video title" do
|
15
|
+
expect(html).to include("The Awesomes: Pilot, Part 1")
|
16
|
+
end
|
17
|
+
|
18
|
+
it "returns photo" do
|
19
|
+
expect(html).to include("http://ib3.huluim.com/video/60245466?region=US&size=600x400")
|
20
|
+
end
|
21
|
+
|
22
|
+
it "returns video description" do
|
23
|
+
expect(html).to include("After Mr. Awesome decides to retire and disband The Awesomes")
|
24
|
+
end
|
25
|
+
|
26
|
+
it "returns video URL" do
|
27
|
+
expect(html).to include("https://secure.hulu.com/embed/0-us7uHJgevua5TeiGwCxQ")
|
28
|
+
end
|
29
|
+
|
30
|
+
it "returns URL" do
|
31
|
+
expect(html).to include(link)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Onebox::Engine::NFBOnebox do
|
4
|
+
let(:link) { "http://nfb.ca" }
|
5
|
+
before do
|
6
|
+
fake(link, response("nfb.response"))
|
7
|
+
end
|
8
|
+
|
9
|
+
it_behaves_like "engines"
|
10
|
+
|
11
|
+
describe "#to_html" do
|
12
|
+
let(:html) { described_class.new(link).to_html }
|
13
|
+
|
14
|
+
it "returns video title" do
|
15
|
+
expect(html).to include("Overdose")
|
16
|
+
end
|
17
|
+
|
18
|
+
it "returns video description" do
|
19
|
+
expect(html).to include("With school, tennis lessons, swimming lessons, art classes,")
|
20
|
+
end
|
21
|
+
|
22
|
+
it "returns video URL" do
|
23
|
+
expect(html).to include("http://www.nfb.ca/film/overdose_en/")
|
24
|
+
end
|
25
|
+
|
26
|
+
it "returns the video embed code" do
|
27
|
+
pending
|
28
|
+
expect(html).to include("")
|
29
|
+
end
|
30
|
+
|
31
|
+
it "returns URL" do
|
32
|
+
expect(html).to include(link)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Onebox::Engine::QikOnebox do
|
4
|
+
let(:link) { "http://qik.com" }
|
5
|
+
before do
|
6
|
+
fake(link, response("qik.response"))
|
7
|
+
end
|
8
|
+
|
9
|
+
it_behaves_like "engines"
|
10
|
+
|
11
|
+
describe "#to_html" do
|
12
|
+
let(:html) { described_class.new(link).to_html }
|
13
|
+
|
14
|
+
it "returns the video title" do
|
15
|
+
expect(html).to include("20910")
|
16
|
+
end
|
17
|
+
|
18
|
+
it "returns the video author" do
|
19
|
+
expect(html).to include("mitesh patel")
|
20
|
+
end
|
21
|
+
|
22
|
+
it "returns the video uploader photo" do
|
23
|
+
expect(html).to include("me_large.jpg")
|
24
|
+
end
|
25
|
+
|
26
|
+
it "returns the video URL" do
|
27
|
+
expect(html).to include(link)
|
28
|
+
end
|
29
|
+
|
30
|
+
it "returns the video embed code" do
|
31
|
+
pending
|
32
|
+
expect(html).to include("clsid:d27cdb6e-ae6d-11cf-96b8-444553540000")
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Onebox::Engine::Revision3Onebox do
|
4
|
+
let(:link) { "http://revision3.com" }
|
5
|
+
before do
|
6
|
+
fake(link, response("revision3.response"))
|
7
|
+
end
|
8
|
+
|
9
|
+
it_behaves_like "engines"
|
10
|
+
|
11
|
+
describe "#to_html" do
|
12
|
+
let(:html) { described_class.new(link).to_html }
|
13
|
+
|
14
|
+
it "returns video title" do
|
15
|
+
expect(html).to include("Blue Shark Bites Diver's Arm")
|
16
|
+
end
|
17
|
+
|
18
|
+
it "returns video image" do
|
19
|
+
expect(html).to include("discoverysharks--0029--blue-sharks--medium.thumb.jpg")
|
20
|
+
end
|
21
|
+
|
22
|
+
it "returns video description" do
|
23
|
+
expect(html).to include("Blue Sharks swimming and eating in the open ocean.")
|
24
|
+
end
|
25
|
+
|
26
|
+
it "returns video URL" do
|
27
|
+
expect(html).to include("https://revision3.com/player-v22668")
|
28
|
+
end
|
29
|
+
|
30
|
+
it "returns video embed code"
|
31
|
+
|
32
|
+
it "returns URL" do
|
33
|
+
expect(html).to include(link)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Onebox::Engine::SlideshareOnebox do
|
4
|
+
let(:link) { "http://slideshare.net" }
|
5
|
+
before do
|
6
|
+
fake(link, response("slideshare.response"))
|
7
|
+
end
|
8
|
+
|
9
|
+
it_behaves_like "engines"
|
10
|
+
|
11
|
+
describe "#to_html" do
|
12
|
+
let(:html) { described_class.new(link).to_html }
|
13
|
+
|
14
|
+
it "returns presentation title" do
|
15
|
+
expect(html).to include("12 Local Traditions That")
|
16
|
+
end
|
17
|
+
|
18
|
+
it "returns presentation description" do
|
19
|
+
expect(html).to include("12 Local traditions that will make")
|
20
|
+
end
|
21
|
+
|
22
|
+
it "returns presentation image" do
|
23
|
+
expect(html).to include("12localtraditions-130729070157-phpapp01-thumbnail-4")
|
24
|
+
end
|
25
|
+
|
26
|
+
it "returns URL" do
|
27
|
+
expect(html).to include(link)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|