aboutsummaryrefslogtreecommitdiffstats
path: root/spec/models/refinery/blog
diff options
context:
space:
mode:
authorUģis Ozols <ugis.ozolss@gmail.com>2012-05-05 17:52:28 +0300
committerUģis Ozols <ugis.ozolss@gmail.com>2012-05-05 17:52:28 +0300
commit65f84593fa2f9706cd9491425d9e572d4ab5b22c (patch)
treed76dd101ed20eeee61be66497d6883e27df759b0 /spec/models/refinery/blog
parentab1fa7ec324394e7649343ba883131b610b5929e (diff)
downloadrefinerycms-blog-65f84593fa2f9706cd9491425d9e572d4ab5b22c.tar.gz
refinerycms-blog-65f84593fa2f9706cd9491425d9e572d4ab5b22c.tar.bz2
refinerycms-blog-65f84593fa2f9706cd9491425d9e572d4ab5b22c.zip
Set published_time as Time.utc to avoid hackery needed later to compare dates.
Diffstat (limited to 'spec/models/refinery/blog')
-rw-r--r--spec/models/refinery/blog/post_spec.rb13
1 files changed, 4 insertions, 9 deletions
diff --git a/spec/models/refinery/blog/post_spec.rb b/spec/models/refinery/blog/post_spec.rb
index 19db0ca..2f34eb8 100644
--- a/spec/models/refinery/blog/post_spec.rb
+++ b/spec/models/refinery/blog/post_spec.rb
@@ -72,20 +72,15 @@ module Refinery
describe ".published_dates_older_than" do
before do
- @post1 = FactoryGirl.create(:blog_post, :published_at => Time.now - 20.minutes)
- @post2 = FactoryGirl.create(:blog_post, :published_at => Time.now - 15.minutes)
+ @post1 = FactoryGirl.create(:blog_post, :published_at => Time.utc(2012, 05, 01, 15, 20))
+ @post2 = FactoryGirl.create(:blog_post, :published_at => Time.utc(2012, 05, 01, 15, 30))
FactoryGirl.create(:blog_post, :published_at => Time.now)
end
it "returns all published dates older than the argument" do
- # I'm converting .to_i here and later because of millisecond comparison issue
- expected = [@post2.published_at.to_i, @post1.published_at.to_i]
+ expected = [@post2.published_at, @post1.published_at]
- 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)
+ described_class.published_dates_older_than(5.minutes.ago).should eq(expected)
end
end