Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

fix feeds that only have 1 entry

  • Loading branch information...
commit 3aff19365610271c3af11fb956ce1e88de8e938d 1 parent 0b19ec1
Tony Pitale tpitale authored
2  lib/garb/management/feed.rb
@@ -15,7 +15,7 @@ def parsed_response
15 15
16 16 def entries
17 17 # possible to have nil entries, yuck
18   - parsed_response ? Array(parsed_response['feed']['entry']).flatten.compact : []
  18 + parsed_response ? [parsed_response['feed']['entry']].flatten.compact : []
19 19 end
20 20
21 21 def response
5 test/unit/garb/management/feed_test.rb
@@ -23,6 +23,11 @@ class FeedTest < MiniTest::Unit::TestCase
23 23 assert_equal ['entry1', 'entry2'], @feed.entries
24 24 end
25 25
  26 + should "handle case of a single entry" do
  27 + @feed.stubs(:parsed_response).returns({'feed' => {'entry' => {'profile_id' => '12345'}}})
  28 + assert_equal [{'profile_id' => '12345'}], @feed.entries
  29 + end
  30 +
26 31 should "have an empty array for entries without a response" do
27 32 @feed.stubs(:parsed_response).returns(nil)
28 33 assert_equal [], @feed.entries

0 comments on commit 3aff193

Please sign in to comment.
Something went wrong with that request. Please try again.