This project is archived and is in readonly mode.

#5634 ✓resolved
Jim Wilson

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

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>

Referenced by

Pages