I recently upgraded my application to rails 7 and now a bunch of my tests are failing with the below error.
ActionDispatch::Request::Session::DisabledSessionError: Your application has sessions disabled. To write to the session you must first configure a session store
I am suspecting this has something to do with devise
.
Below is the code that is causing issues.
def login_user(user)
post "/api/v2/login", :params => { :username => user.username, :password => user.password }
assert_response :success, response.body
json = JSON.parse(response.body)
{:authentication_token => json["user"]["authentication_token"]}
end
If I remove the line config.api_only = true
from the application.rb
file then the test cases pass without any hitch but I can't really remove that line due to other issues. Does anybody a proper solution for this issue ?