Permalink
Browse files

Bring in timecop to improve the reliability of the Page#published_at …

…spec
  • Loading branch information...
1 parent 06f8196 commit f969983767bedcd9f76c42927125408391a694f3 @jayzes jayzes committed with jayzes Sep 11, 2012
Showing with 5 additions and 2 deletions.
  1. +1 −0 Gemfile
  2. +4 −2 spec/models/page_spec.rb
View
@@ -27,6 +27,7 @@ group :test do
gem 'shoulda-matchers'
gem 'database_cleaner'
gem 'selenium-webdriver', '>= 2.21.2'
+ gem 'timecop'
end
# Specify your gem's dependencies in ..gemspec
View
@@ -128,8 +128,10 @@
describe '#publish!' do
it 'sets the published_at date to now' do
- page.publish!
- page.published_at.to_s.should == Time.zone.now.to_s
+ Timecop.freeze(Time.now) do
+ page.publish!
+ page.published_at.to_s.should == Time.zone.now.to_s
+ end
end
it 'creates a new published verson' do

0 comments on commit f969983

Please sign in to comment.