Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix feeds that only have 1 entry

  • Loading branch information...
commit 3aff19365610271c3af11fb956ce1e88de8e938d 1 parent 0b19ec1
@tpitale tpitale authored
View
2  lib/garb/management/feed.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
View
5 test/unit/garb/management/feed_test.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.