Last Updated: February 25, 2016
·
613
· descentintomael

Easy Password Timeout Test

Using the Timecop gem, you can easily test your password timeouts for your users. I use the following snippet in my spec test:

u = FactoryGirl.create(:user)
Timecop.travel 30.days.from_now
u.current_password?.should be_false
Timecop.return