diff options
author | Uģis Ozols <ugis.ozolss@gmail.com> | 2012-04-26 11:44:04 +0300 |
---|---|---|
committer | Uģis Ozols <ugis.ozolss@gmail.com> | 2012-04-26 11:44:04 +0300 |
commit | ab1fa7ec324394e7649343ba883131b610b5929e (patch) | |
tree | 5b2e4da914466fa20fcb68f3b5ca8f99d7fceecd /spec/models | |
parent | d1bfab99ce9a0cd756efa4a8da61bff1d8a5edcf (diff) | |
download | refinerycms-blog-ab1fa7ec324394e7649343ba883131b610b5929e.tar.gz refinerycms-blog-ab1fa7ec324394e7649343ba883131b610b5929e.tar.bz2 refinerycms-blog-ab1fa7ec324394e7649343ba883131b610b5929e.zip |
Fix millisecond comparison issue in post spec.
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/refinery/blog/post_spec.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/spec/models/refinery/blog/post_spec.rb b/spec/models/refinery/blog/post_spec.rb index 5599b4d..19db0ca 100644 --- a/spec/models/refinery/blog/post_spec.rb +++ b/spec/models/refinery/blog/post_spec.rb @@ -78,9 +78,14 @@ module Refinery 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 |