I'd like to customize the time period after which my Rails app will automatically end a user's session.
I found this question to give me exactly what I need, but I'd like to approach this through TDD. I've got a relatively solid test suite for the application, I'm just a little lost when it comes to testing if a user's session has expired, other than having a test sit there and wait for the session to expire after x.minutes
have elapsed. Surely there's a better way.
I checked the Devise and Warden documentation for test helpers dealing with this and came up dry. Anyone have any tips?
How about stubbing user.timedout?
to return true? Or, you could pass a custom time in your test that exceeds your custom timeout value, like user.timed_out?(31.minutes.ago)
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With