test/facebook_test.rb in muri-0.0.13 vs test/facebook_test.rb in muri-1.0.0
- old
+ new
@@ -1,62 +1,50 @@
require 'lib/muri.rb'
shared_examples_for "Facebook parse" do
it "should be Facebook service" do
- @a.service.should == 'Facebook'
+ @a.media_service.should == 'Facebook'
end
it "should be valid" do
@a.valid?.should == true
end
end
+
shared_examples_for "Facebook parse photo" do
it_should_behave_like "Facebook parse"
it "should have media api type = FACEBOOK_PHOTO" do
@a.media_api_type.should == Muri::FACEBOOK_PHOTO
end
end
-# shared_examples_for "Facebook parse video" do
-# it_should_behave_like "Facebook parse"
-# it "should have media api type = FACEBOOK_VIDEO" do
-# @a.media_api_type.should == Muri::FACEBOOK_VIDEO
-# end
-# end
-
-# describe "Facebook parse first" do
-# before(:all) do
-# @a = Muri.parse 'http://www.facebook.com/v/614695029223'
-# end
-# it_should_behave_like "Facebook parse video"
-#
-# it "should have media id" do
-# @a.media_id.should == '614695029223'
-# end
-#
-# it "should have a media_url" do
-# @a.media_url.should == 'http://www.facebook.com/v/614695029223'
-# end
-#
-# it "should have media api id" do
-# @a.media_api_id.should == '614695029223'
-# end
-# end
-
-describe "Facebook parse second" do
- before(:all) do
- @a = Muri.parse 'http://www.facebook.com/photo.php?pid=34929102&l=a1abf8cd37&id=15201063'
- end
- it_should_behave_like "Facebook parse photo"
-
- it "should have media id" do
- @a.media_id.should == '34929102'
- end
+{'http://www.facebook.com/photo.php?pid=34929102&l=a1abf8cd37&id=15201063' =>
+ { :media_id => '34929102',
+ :media_website => 'http://www.facebook.com/photo.php?pid=34929102&l=a1abf8cd37&id=15201063',
+ :media_api_id => 65288068484364750
+ }
+}.each do |url, values|
+ describe "Facebook parse #{url}" do
+ before(:all) do
+ @a = Muri.parse url
+ end
+ it_should_behave_like "Facebook parse photo"
- it "should have a website" do
- @a.website.should == 'http://www.facebook.com/photo.php?pid=34929102&l=a1abf8cd37&id=15201063'
+ if values[:media_id]
+ it "should have media id" do
+ @a.media_id.should == values[:media_id]
+ end
+ end
+
+ if values[:media_website]
+ it "should have a website" do
+ @a.media_website.should == values[:media_website]
+ end
+ end
+
+ if values[:media_api_id]
+ it "should have media api id" do
+ @a.media_api_id.should == values[:media_api_id]
+ end
+ end
end
-
- it "should have media api id" do
- @a.media_api_id.should == 65288068484364750
- end
end
\ No newline at end of file