Reputation: 712
This is the contents of my session_store.rb
file:
Rails.application.config.session_store :cookie_store, key: '_myapp_session', expire_after: (Rails.env.production? ? 2.hours : 3.minute)
I would like to run a test when a request is submitted against a timed-out session from an anonymous (not logged-in) user:
scenario 'Submit form when session has timed out' do
# Not logged in user
visit my_form_path
# set session timeout to 1 second or force cookie session timeout
????
click_button('Submit')
# Verify expectations
...
end
I'm using rails 4.2, capybara 2.12, and capybara-webkit 1.12, rspec 3.3. I'm also using devise 4.2, but my scenario if for an anonymous user.
When I run my app on development, I can wait till session times out and I see the app is working as expected, but I want to have this tested.
Upvotes: 1
Views: 788
Reputation: 712
It is currently not possible to force a cookie session timeout with capybara-webkit.
https://github.com/thoughtbot/capybara-webkit/issues/978
Upvotes: 0