rails: Incompatibility between Rack::Session and ActionDispatch::Request::Session

It is preventing integration testing in test-unit of my Grape app mounted in my Rails 4.1.1 routes.rb file.

Here’s a simplified example: https://github.com/pboling/x-cascade_header_rails/tree/e34a94ba76f9350aed13486f282e99a98e2d9821

(Never mind the name of the repo… I was trying to understand the X-Cascade Header.)

Repro after checking out the repo, bundle install, rake db:migrate:

bin/rake test
...
  1) Failure:
XCascadeGrapeTest#test_/api/auth/login_invalid_credentials_is_401 [/Users/pboling/Documents/src/my/x-cascade_header_rails/test/integration/x_cascade_grape_test.rb:10]:
{"error":"undefined method `each' for #\u003cActionDispatch::Request::Session:0x103aebb00 not yet loaded\u003e"}.
Expected: 401
  Actual: 500
  1. Here’s another of the exact same error from Sinatra mounted in rails: https://gist.github.com/toolmantim/9597022
  2. Here is another report of the same error from a Grape app mounted in Rails 4.0.2: http://stackoverflow.com/questions/22439361/rspec-testing-api-with-rack-protection

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 17 (10 by maintainers)

Commits related to this issue

Most upvoted comments

Fixed via #24820.