BUGFIX: spec would blow up when DST kicked in

This commit is contained in:
Sam 2014-03-10 10:11:54 +11:00
parent 68630af718
commit 3f0964bf60

View File

@ -529,20 +529,24 @@ describe Topic do
context 'topic was set to close when it was created' do
it 'puts the autoclose duration in the moderator post' do
@topic.created_at = 3.days.ago
@topic.update_status(status, true, @user)
expect(@topic.posts.last.raw).to include "closed after 3 days"
freeze_time(Time.new(2000,1,1)) do
@topic.created_at = 3.days.ago
@topic.update_status(status, true, @user)
expect(@topic.posts.last.raw).to include "closed after 3 days"
end
end
end
context 'topic was set to close after it was created' do
it 'puts the autoclose duration in the moderator post' do
@topic.created_at = 7.days.ago
Timecop.freeze(2.days.ago) do
@topic.set_auto_close(48)
freeze_time(Time.new(2000,1,1)) do
@topic.created_at = 7.days.ago
freeze_time(2.days.ago) do
@topic.set_auto_close(48)
end
@topic.update_status(status, true, @user)
expect(@topic.posts.last.raw).to include "closed after 2 days"
end
@topic.update_status(status, true, @user)
expect(@topic.posts.last.raw).to include "closed after 2 days"
end
end
end