Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

write_cookies! in ActionDispatch::TestRequest won't write nil value #2070

Merged
merged 0 commits into from Jul 14, 2011

Conversation

bfolkens
Copy link

Rack::Utils.escape(str) breaks when cookie value is nil.

NoMethodError: private method `gsub' called for nil:NilClass
    activesupport (3.1.0.rc4) lib/active_support/whiny_nil.rb:48:in `method_missing'
    rack (1.3.1) lib/rack/backports/uri/common.rb:24:in `encode_www_form_component'
    rack (1.3.1) lib/rack/utils.rb:23:in `escape'
    actionpack (3.1.0.rc4) lib/action_dispatch/testing/test_request.rb:86:in `escape_cookie'
    actionpack (3.1.0.rc4) lib/action_dispatch/testing/test_request.rb:81:in `write_cookies!'

@spastorino
Copy link
Contributor

We need a test case in order to merge this. Thanks.

@pixeltrix
Copy link
Contributor

The test is a bit implementation specific - personally I'd prefer it if just tests that setting a cookie to a nil value doesn't raise an error

@spastorino
Copy link
Contributor

Agree with @pixeltrix, also we need one commit for the tests + patch, can you check if it doesn't raise and squash the commits into one?

@bfolkens bfolkens merged commit 0820283 into rails:3-1-stable Jul 14, 2011
@bfolkens
Copy link
Author

Sorry, looks like this one got closed out automatically

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants