I'm using rails 4 with the following gems:
Capybara works as expected in normal scenarios/examples, but when I want access to a cookie or session, I get a NameError:
undefined local variable or method `session'
I have a custom class I'm using that stores cookie data and retrieves it to remember things about the user and then present certain things on the screen.
But I can't seem to get the tests to pass and I can't view the cookie or session.
Does it need to be mocked? How can I do this?
Capybara.current_session.driver.request.session
works in 2.17.0. I'm assuming much hasn't changed though since 2.4.
Webkit exposes cookies like this:
page.driver.browser.manage.all_cookies
Reference here: https://github.com/thoughtbot/capybara-webkit/issues/168
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