From ab1fa7ec324394e7649343ba883131b610b5929e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?U=C4=A3is=20Ozols?= Date: Thu, 26 Apr 2012 11:44:04 +0300 Subject: Fix millisecond comparison issue in post spec. --- spec/models/refinery/blog/post_spec.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'spec/models/refinery') 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 -- cgit v1.2.3