I think you should remove params
key before user
parameters, e.g.:
test "invalid signup information" do
get signup_path
assert_no_difference 'User.count' do
post users_path, user: { name: "",
email: "user@invalid",
password: "foo",
password_confirmation: "bar" }
end
assert_template 'users/new'
assert_select 'div#error_explanation'
assert_select 'div.field_with_errors'
end
Also you can debug received parameters in controller with pry:
- add gem
pry
to your Gemfile (if there is no one); - run
$ bundle install
; - add
binding.pry
in controller before methoduser_params
is called; - check that
params
contains expected parameters.
2
solved Ruby on rails tutorial – integration test – valid/invalid user info sign failing – user_param issue?