Permalink
Browse files

fix feeds that only have 1 entry

  • Loading branch information...
1 parent 0b19ec1 commit 3aff19365610271c3af11fb956ce1e88de8e938d @tpitale tpitale committed Jan 9, 2011
Showing with 6 additions and 1 deletion.
  1. +1 −1 lib/garb/management/feed.rb
  2. +5 −0 test/unit/garb/management/feed_test.rb
@@ -15,7 +15,7 @@ def parsed_response
def entries
# possible to have nil entries, yuck
- parsed_response ? Array(parsed_response['feed']['entry']).flatten.compact : []
+ parsed_response ? [parsed_response['feed']['entry']].flatten.compact : []
end
def response
@@ -23,6 +23,11 @@ class FeedTest < MiniTest::Unit::TestCase
assert_equal ['entry1', 'entry2'], @feed.entries
end
+ should "handle case of a single entry" do
+ @feed.stubs(:parsed_response).returns({'feed' => {'entry' => {'profile_id' => '12345'}}})
+ assert_equal [{'profile_id' => '12345'}], @feed.entries
+ end
+
should "have an empty array for entries without a response" do
@feed.stubs(:parsed_response).returns(nil)
assert_equal [], @feed.entries

0 comments on commit 3aff193

Please sign in to comment.