From 3922c9b6b5d56cc6548c976f3caae977d7409db2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Tue, 20 Aug 2013 21:45:58 +0200 Subject: [PATCH] FIX: specs for ruby 2.0.0-p247 --- spec/components/topic_view_spec.rb | 5 +++-- spec/models/post_spec.rb | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/spec/components/topic_view_spec.rb b/spec/components/topic_view_spec.rb index e94bd3608cf..6ee0831c5ae 100644 --- a/spec/components/topic_view_spec.rb +++ b/spec/components/topic_view_spec.rb @@ -191,10 +191,11 @@ describe TopicView do context '#recent_posts' do before do - 24.times do # our let()s have already created 3 - Fabricate(:post, topic: topic, user: first_poster) + 24.times do |t| # our let()s have already created 3 + Fabricate(:post, topic: topic, user: first_poster, created_at: t.seconds.from_now) end end + it 'returns at most 25 recent posts ordered newest first' do recent_posts = topic_view.recent_posts diff --git a/spec/models/post_spec.rb b/spec/models/post_spec.rb index 6f5b2c69dfb..2cbff032885 100644 --- a/spec/models/post_spec.rb +++ b/spec/models/post_spec.rb @@ -39,7 +39,9 @@ describe Post do describe '#by_newest' do it 'returns posts ordered by created_at desc' do - 2.times { Fabricate(:post) } + 2.times do |t| + Fabricate(:post, created_at: t.seconds.from_now) + end Post.by_newest.first.created_at.should > Post.by_newest.last.created_at end end