Commit d8b59c1a3315b3f9b1576a141dc6d614fb0a7976
1 parent
a87f6311
Exists in
master
and in
29 other branches
ActionItem1049: reversing the order of feed items
Showing
2 changed files
with
2 additions
and
2 deletions
Show diff stats
lib/feed_handler.rb
@@ -29,7 +29,7 @@ class FeedHandler | @@ -29,7 +29,7 @@ class FeedHandler | ||
29 | container.fetched_at = Time.now | 29 | container.fetched_at = Time.now |
30 | parsed_feed = parse(content) | 30 | parsed_feed = parse(content) |
31 | container.feed_title = parsed_feed.title | 31 | container.feed_title = parsed_feed.title |
32 | - parsed_feed.items[0..container.limit-1].each do |item| | 32 | + parsed_feed.items[0..container.limit-1].reverse.each do |item| |
33 | container.add_item(item.title, item.link, item.date, item.content) | 33 | container.add_item(item.title, item.link, item.date, item.content) |
34 | end | 34 | end |
35 | container.finish_fetch | 35 | container.finish_fetch |
test/unit/feed_handler_test.rb
@@ -26,7 +26,7 @@ class FeedHandlerTest < Test::Unit::TestCase | @@ -26,7 +26,7 @@ class FeedHandlerTest < Test::Unit::TestCase | ||
26 | should 'process feed and populate container' do | 26 | should 'process feed and populate container' do |
27 | handler.process(container) | 27 | handler.process(container) |
28 | assert_equal 'Feed for unit tests', container.feed_title | 28 | assert_equal 'Feed for unit tests', container.feed_title |
29 | - assert_equal ["Last POST", "Second POST", "First POST"], container.feed_items.map {|item| item[:title]} | 29 | + assert_equal ["First POST", "Second POST", "Last POST"], container.feed_items.map {|item| item[:title]} |
30 | end | 30 | end |
31 | 31 | ||
32 | should 'raise exception when parser nil' do | 32 | should 'raise exception when parser nil' do |