From 84a167725db1ebff84399857526a4dbf7cba6d90 Mon Sep 17 00:00:00 2001 From: Jaime Iniesta Date: Tue, 12 Feb 2013 07:43:18 -0500 Subject: [PATCH] Add specs for oneboxer components: amazon, android, apple, flickr and wikipedia --- .../components/oneboxer/amazon_onebox_spec.rb | 36 +++++++++++++++++++ .../oneboxer/android_app_store_onebox_spec.rb | 34 ++++++++++++++++++ .../oneboxer/apple_app_onebox_spec.rb | 34 ++++++++++++++++++ .../components/oneboxer/flickr_onebox_spec.rb | 17 +++++++++ .../oneboxer/wikipedia_onebox_spec.rb | 34 ++++++++++++++++++ 5 files changed, 155 insertions(+) create mode 100644 spec/components/oneboxer/amazon_onebox_spec.rb create mode 100644 spec/components/oneboxer/android_app_store_onebox_spec.rb create mode 100644 spec/components/oneboxer/apple_app_onebox_spec.rb create mode 100644 spec/components/oneboxer/flickr_onebox_spec.rb create mode 100644 spec/components/oneboxer/wikipedia_onebox_spec.rb diff --git a/spec/components/oneboxer/amazon_onebox_spec.rb b/spec/components/oneboxer/amazon_onebox_spec.rb new file mode 100644 index 00000000000..513a98a41f5 --- /dev/null +++ b/spec/components/oneboxer/amazon_onebox_spec.rb @@ -0,0 +1,36 @@ +# encoding: utf-8 + +require 'spec_helper' +require 'oneboxer' +require 'oneboxer/amazon_onebox' + +describe Oneboxer::AmazonOnebox do + it "generates the expected onebox for Amazon" do + o = Oneboxer::AmazonOnebox.new("http://www.amazon.com/Ruby-Programming-Language-David-Flanagan/dp/0596516177") + o.onebox.should == expected_amazon_result + end + +private + def expected_amazon_result + < + +
+ +

The Ruby Programming Language (Paperback)

+

David Flanagan, Yukihiro Matsumoto

+ +The Ruby Programming Language is the authoritative guide to Ruby ... + +
+
+ +EXPECTED + end +end \ No newline at end of file diff --git a/spec/components/oneboxer/android_app_store_onebox_spec.rb b/spec/components/oneboxer/android_app_store_onebox_spec.rb new file mode 100644 index 00000000000..6e84351d0b9 --- /dev/null +++ b/spec/components/oneboxer/android_app_store_onebox_spec.rb @@ -0,0 +1,34 @@ +# encoding: utf-8 + +require 'spec_helper' +require 'oneboxer' +require 'oneboxer/android_app_store_onebox' + +describe Oneboxer::AndroidAppStoreOnebox do + it "generates the expected onebox for Android App Store" do + o = Oneboxer::AndroidAppStoreOnebox.new("https://play.google.com/store/apps/details?id=com.moosoft.parrot") + o.onebox.should == expected_android_app_store_result + end + +private + def expected_android_app_store_result + < + +
+ +

Talking Parrot

+ + Listen to the parrot repeat what you say. A Fun application for all ages. Upgrade to Talking Parrot Pro to save sounds, set them as your ringtone and control recording. Press the MENU button to access the settings where you can change the record time and repeat count. This app uses anonymous usage stats to understand and improve performance. Comments and feedback welcome. +
+
+ +EXPECTED + end +end \ No newline at end of file diff --git a/spec/components/oneboxer/apple_app_onebox_spec.rb b/spec/components/oneboxer/apple_app_onebox_spec.rb new file mode 100644 index 00000000000..a01b4b05bd6 --- /dev/null +++ b/spec/components/oneboxer/apple_app_onebox_spec.rb @@ -0,0 +1,34 @@ +# encoding: utf-8 + +require 'spec_helper' +require 'oneboxer' +require 'oneboxer/apple_app_onebox' + +describe Oneboxer::AppleAppOnebox do + it "generates the expected onebox for Apple app" do + o = Oneboxer::AppleAppOnebox.new("https://itunes.apple.com/us/app/minecraft-pocket-edition-lite/id479651754") + o.onebox.should == expected_apple_app_result + end + +private + def expected_apple_app_result + < + +
+ +

Minecraft – Pocket Edition Lite

+ + Imagine it, build it. Create worlds on the go with Minecraft - Pocket EditionThis is the Lite version of Minecraft - Pocket Edition. Minecraft - Pocket Edition allows you to build on the go. Use blocks to create masterpieces as you travel, hangout with friends, sit at the park, the possibilities are endless. Move beyond the limits of your computer and play Minecraft everywhere you go.Limitations of the Lite version* The world is not saved between sessions* Multiplayer worlds can not be copied to +
+
+ +EXPECTED + end +end \ No newline at end of file diff --git a/spec/components/oneboxer/flickr_onebox_spec.rb b/spec/components/oneboxer/flickr_onebox_spec.rb new file mode 100644 index 00000000000..2d6603a3681 --- /dev/null +++ b/spec/components/oneboxer/flickr_onebox_spec.rb @@ -0,0 +1,17 @@ +# encoding: utf-8 + +require 'spec_helper' +require 'oneboxer' +require 'oneboxer/flickr_onebox' + +describe Oneboxer::FlickrOnebox do + it "generates the expected onebox for Flickr" do + o = Oneboxer::FlickrOnebox.new("http://www.flickr.com/photos/jaimeiniesta/3303881265") + o.onebox.should == expected_flickr_result + end + +private + def expected_flickr_result + "" + end +end \ No newline at end of file diff --git a/spec/components/oneboxer/wikipedia_onebox_spec.rb b/spec/components/oneboxer/wikipedia_onebox_spec.rb new file mode 100644 index 00000000000..1243f823864 --- /dev/null +++ b/spec/components/oneboxer/wikipedia_onebox_spec.rb @@ -0,0 +1,34 @@ +# encoding: utf-8 + +require 'spec_helper' +require 'oneboxer' +require 'oneboxer/wikipedia_onebox' + +describe Oneboxer::WikipediaOnebox do + it "generates the expected onebox for Wikipedia" do + o = Oneboxer::WikipediaOnebox.new("http://en.wikipedia.org/wiki/Ruby") + o.onebox.should == expected_wikipedia_result + end + +private + def expected_wikipedia_result + < + +
+ +

Ruby

+ + A ruby is a pink to blood-red colored gemstone, a variety of the mineral corundum (aluminium oxide). The red color is caused mainly by the presence of the element chromium. Its name comes from ruber, Latin for red. Other varieties of gem-quality corundum are called sapphires. The ruby is considered one of the four precious stones, together with the sapphire, the emerald, and the diamond. Prices of rubies are primarily determined by color. The brightest and most valuable "red" called pigeon blood-... +
+
+ +EXPECTED + end +end \ No newline at end of file