spec/feedzirra/feed_spec.rb in somezack-feedzirra-0.0.2 vs spec/feedzirra/feed_spec.rb in somezack-feedzirra-0.0.3
- old
+ new
@@ -111,11 +111,11 @@
end
describe "fetching feeds" do
before(:each) do
@paul_feed_url = "http://feeds.feedburner.com/PaulDixExplainsNothing"
- @trotter_feed_url = "http://feeds.feedburner.com/trottercashion"
+ @trotter_feed_url = "http://feeds2.feedburner.com/trottercashion"
end
describe "handling many feeds" do
it "should break a large number into more manageable blocks of 40"
it "should add to the queue as feeds finish (instead of waiting for each block of 40 to finsih)"
@@ -137,10 +137,15 @@
results.keys.should include(@paul_feed_url)
results.keys.should include(@trotter_feed_url)
results[@paul_feed_url].should =~ /Paul Dix/
results[@trotter_feed_url].should =~ /Trotter Cashion/
end
+
+ it "should always return a hash when passed an array" do
+ results = Feedzirra::Feed.fetch_raw([@paul_feed_url])
+ results.class.should == Hash
+ end
end
describe "#fetch_and_parse" do
it "should return a feed object for a single url" do
feed = Feedzirra::Feed.fetch_and_parse(@paul_feed_url)
@@ -165,9 +170,14 @@
it "should return a hash of feed objects with the passed in feed_url for the key and parsed feed for the value for multiple feeds" do
feeds = Feedzirra::Feed.fetch_and_parse([@paul_feed_url, @trotter_feed_url])
feeds.size.should == 2
feeds[@paul_feed_url].feed_url.should == @paul_feed_url
feeds[@trotter_feed_url].feed_url.should == @trotter_feed_url
+ end
+
+ it "should always return a hash when passed an array" do
+ feeds = Feedzirra::Feed.fetch_and_parse([@paul_feed_url])
+ feeds.class.should == Hash
end
it "should yeild the url and feed object to a :on_success lambda" do
successful_call_mock = mock("successful_call_mock")
successful_call_mock.should_receive(:call)
\ No newline at end of file