Easy Password Timeout Test

Posted on

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

Leave a Reply

Your email address will not be published.