Skip to content

Commit

Permalink
Add a test for feed update order
Browse files Browse the repository at this point in the history
  • Loading branch information
carols10cents committed Feb 27, 2012
1 parent 2dbb614 commit 4864f66
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/models/feed_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,18 @@
end
end
end

describe "#atom" do
it "sorts updates in reverse chronological order by created_at" do
f = Fabricate(:feed)
later = Fabricate(:update, :feed => f, :created_at => 1.day.ago)
earlier = Fabricate(:update, :feed => f, :created_at => 2.days.ago)

xml = Nokogiri.XML(f.atom("http://example.com"))
entries = xml.xpath("//xmlns:entry")

entries.first.at_xpath("xmlns:id").content.must_match(/#{later.id}/)
entries.last.at_xpath("xmlns:id").content.must_match(/#{earlier.id}/)
end
end
end

0 comments on commit 4864f66

Please sign in to comment.