🧑💻 Multiple requests and session variables in functional tests
Posted on September 12, 2008
I spent way too much time today figuring out why this doesn't work as expected:
I expected the second request to have session[:user_id] == 2.
That's not the case. Functional tests in Rails are designed to make only one request per test and thus the second assignment doesn't change the session data.
To make it work as expected, split it into multiple tests: