Commit e1db8da3c08b21fc00b7f120f76539e1719664ed
Committed by
Antonio Terceiro
1 parent
959d88c4
Exists in
master
and in
28 other branches
ActionItem1114: reorder entries in feed block
fixed also a test in the feed_handler that relied in the order of the items
Showing
3 changed files
with
10 additions
and
2 deletions
Show diff stats
app/models/feed_reader_block.rb
test/unit/feed_handler_test.rb
... | ... | @@ -26,7 +26,7 @@ class FeedHandlerTest < Test::Unit::TestCase |
26 | 26 | should 'process feed and populate container' do |
27 | 27 | handler.process(container) |
28 | 28 | assert_equal 'Feed for unit tests', container.feed_title |
29 | - assert_equal ["First POST", "Second POST", "Last POST"], container.feed_items.map {|item| item[:title]} | |
29 | + assert_equivalent ["First POST", "Second POST", "Last POST"], container.feed_items.map {|item| item[:title]} | |
30 | 30 | end |
31 | 31 | |
32 | 32 | should 'raise exception when parser nil' do | ... | ... |
test/unit/feed_reader_block_test.rb
... | ... | @@ -73,4 +73,12 @@ class FeedReaderBlockTest < ActiveSupport::TestCase |
73 | 73 | feed.finish_fetch |
74 | 74 | end |
75 | 75 | |
76 | + should 'display the latest post first' do | |
77 | + %w[ first-post second-post last-post ].each do |i| | |
78 | + feed.add_item(i, "http://localhost/#{i}", Date.today, "some contet for #{i}") | |
79 | + end | |
80 | + | |
81 | + assert_equal %w[ last-post second-post first-post ], feed.feed_items.map{|i|i[:title]} | |
82 | + end | |
83 | + | |
76 | 84 | end | ... | ... |