Good afternoon,
I generated a scaffold of a class of mine, example User. When 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, create is not running. I already put a brakpoint in the controller's create but not there.
Am I doing something wrong?
Thanks in advance for your help