This project is archived and is in readonly mode.
reset_session in action_dispatch/http/request.rb failing in test mode
Reported by Jim Wilson | September 15th, 2010 @ 05:38 PM
I get the below when running one of my tests that does a
reset_session in a ActionController::TestCase
NoMethodError: undefined method `destroy' for #<Hash:0xc672d3c>
actionpack (3.0.0) lib/action_dispatch/http/request.rb:202:in `reset_session'
actionpack (3.0.0) lib/action_controller/metal/rack_delegation.rb:23:in `reset_session'
The following seems to have fixed it for me:
def reset_session
session.destroy if session && session.respond_to?(:destroy)
self.session = {}
@env['action_dispatch.request.flash_hash'] = nil
end
Comments and changes to this ticket
-
Noah September 21st, 2010 @ 06:42 PM
This happens to me as well in a test that happens to call "reset_session" twice in a row. The first reset_session sets "session" to an empty hash, and the second call blows up because "destroy" is not defined on a hash.
-
Franco Catena November 3rd, 2010 @ 05:53 PM
This problem was fixed in this commit: https://github.com/rails/rails/commit/653acac069e66f53b791caa4838a1..., I hope someone change the status to solved.
-
Neeraj Singh November 3rd, 2010 @ 06:08 PM
- State changed from new to resolved
- Importance changed from to Low
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Referenced by
- 6440 Session Reset undefined method `destroy' for {}:Hash https://rails.lighthouseapp.com/projects/8994/tickets/56...