1
Good afternoon,
I generated a scaffold of a class of mine, User example. While running the tests I came across the following failure:
Minitest::Assertion: "User.count" didn't change by 1.
Expected: 3
Actual: 2
test/controllers/users_controller_test.rb:20:in `block in <class:UsersControllerTest>'
the code for this error is:
test "should create user" do
assert_difference('User.count') do
post :create, user: { name: 'teste', password: 'secret', password_confirmation: 'secret' }
end
assert_redirected_to user_path(assigns(:user))
end
This is the code generated by scaffold, I just changed the name reference.
As far as I can tell, the create is not being executed. I already put a brakpoint in the controller create but not there.
Am I doing something wrong?
Thanks for your help
"I just changed the name reference" What do you mean? I didn’t understand what you changed. Maybe this caused the problem. Post also the model code and User controller.
– user7261