Skip to content

rails5 can't access session in ActionDispatch::IntegrationTest #23386

@rubys

Description

@rubys

Reproduction scenario:

rm -rf throwaway
rails new throwaway 
cd throwaway
rails generate scaffold Product name
rails db:migrate
rails test
sed -i -e '/patch product/ i\
    session[:userid] = 0\
' test/controllers/products_controller_test.rb
rails test
BACKTRACE=1 rails test

Test results: throwaway.txt

[this is with rails master]

Note: I reran rails test with BACKTRACE set as the actual error is inside action_dispatch/testing/test_process.

Example with similar code working in Rails 4.2:

Code: http://intertwingly.net/projects/AWDwR4/checkdepot-215-42/section-10.4.html#cmd3
Test: http://intertwingly.net/projects/AWDwR4/checkdepot-215-42/section-10.4.html#cmd8

Results for same example in Rails 5 (master):

http://intertwingly.net/projects/AWDwR4/checkdepot/section-10.4.html#cmd8

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions