nruth / show_me_the_cookies

Cookie manipulation for Capybara (view, delete, …)
161 stars 44 forks source link

Fix incompatibility with rack-test 2.0 #64

Closed juno closed 2 years ago

juno commented 2 years ago

This fixes the following error when calling expire_cookies with rack-test 2.0:

     NoMethodError:
       undefined method `cookie_jar' for nil:NilClass
             @rack_test_driver.browser.current_session.instance_variable_get(:@rack_mock_session).cookie_jar
                                                                                                 ^^^^^^^^^^^

See https://github.com/rack/rack-test/pull/297 for details about rack-test side changes.

I know that this gem has abandoned, however hope this helps for others.

olleolleolle commented 2 years ago

Thanks, this fixed my issue!

Workaround snippet to use this branch:

gem "show_me_the_cookies", github: "juno/show_me_the_cookies", branch: "fix-compatibility-with-rack-test-2.0" # LOCKED: When this PR is merged/released, unlock: https://github.com/nruth/show_me_the_cookies/pull/64
emresimtay commented 2 years ago

Hello there :)

The above solution fixed the issues created from undefined method cookie_jar for nil:NilClass When do you think this will be released?

Many thanks frens 🥇

p.s. this also seems to fixed my tests :)
@rack_test_driver.browser.current_session.instance_variable_get(:@cookie_jar)

mfittko commented 2 years ago

@nruth I think this should be released soon, we were also stumbling over this as we did not have rack-test locked and since we had to upgrade rails due to the latest CVE, we ran into this issue. Sure this will happen to more ppl. Thanks for the fix/review @juno @emresimtay

nruth commented 2 years ago

Looks good. BC isn't a problem, it'll be part of a major release.

juno commented 2 years ago

@nruth Thank you for releasing quickly! 🎉