RailsCasts Pro episodes are now free!
Learn more or hide this
GitHub User: TvL2386
I can't get the timecop to work in my application.
I hope you guys know what's wrong. I've used Ryans code.
What I see is that the reloaded object has nil for the password_reset_sent_at attribute.
1) User#send_password_reset saves the time the password reset was sent
Failure/Error: user.reload.password_reset_sent_at.should eq(Time.zone.now)
expected Fri, 31 Dec -0001 23:40:28 UTC +00:00
(compared using ==)
# ./spec/models/user_spec.rb:24:in `block (3 levels) in <top (required)>'
it "saves the time the password reset was sent" do
puts 'printing user password_reset_sent_at'
puts 'printing reloaded user password_reset_sent_at'
puts 'printing last user password_reset_sent_at'
# user.rb (model)
self.password_reset_sent_at = Time.zone.now
printing user password_reset_sent_at
Fri, 31 Dec -0001 23:40:28 UTC +00:00
printing reloaded user password_reset_sent_at
printing last user password_reset_sent_at
I've been trying and trying to start with testing, but it's very easy to get lost. Thanks for this great railscast! I will definately pick up on testing again!
I watch all your eps and love them!