Skip to content

Commit

Permalink
Fix millisecond comparison issue in post spec.
Browse files Browse the repository at this point in the history
  • Loading branch information
ugisozols committed Apr 26, 2012
1 parent d1bfab9 commit ab1fa7e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions spec/models/refinery/blog/post_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,14 @@ module Blog
end

it "returns all published dates older than the argument" do
expected = [@post2.published_at, @post1.published_at]
# I'm converting .to_i here and later because of millisecond comparison issue
expected = [@post2.published_at.to_i, @post1.published_at.to_i]

described_class.published_dates_older_than(5.minutes.ago).should eq(expected)
publish_times = []
described_class.published_dates_older_than(5.minutes.ago).each do |published_at|
publish_times << published_at.to_i
end
publish_times.should eq(expected)
end
end

Expand Down

0 comments on commit ab1fa7e

Please sign in to comment.