Skip to content

Commit

Permalink
Bring in timecop to improve the reliability of the Page#published_at …
Browse files Browse the repository at this point in the history
…spec
  • Loading branch information
Jay Zeschin committed Sep 11, 2012
1 parent 06f8196 commit f969983
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions Gemfile
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions spec/models/page_spec.rb
Expand Up @@ -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
Expand Down

0 comments on commit f969983

Please sign in to comment.