Converting an app from Rails 4 to Rails 5. Everything is going well, though it seems this line is causing an issue. In Rails 4, it was:
get :show, token: user.token, email: user.email
With Rails 5, the syntax is:
get :show, params: { token: user.token, email: user.email }, format: :json
The problem in this case is that user.token
is nil
. Under Rails 4, the controller received the params as such:
{"token"=>nil, "email"=>"johndoe1@...", "action"=>"show"}
With Rails 5, now some tests are failing as the token
is received as:
{"token"=>"", "email"=>"johndoe1@...", "action"=>"show"}
How can I get Rails 5 to respect it is null
and not an empty string?
I don't know if this will affect get
s outside of spec but I cannot find any solution to this. I tried as: :json
, as well as format: :json
, and even to_json
, and nothing.
Thank you