I am running the functional test in Ruby and they are failing.
I'm getting this as result from running rake test:functionals
1) Failure:
test_should_create_user(UsersControllerTest) [test/functional/users_controller_t
est.rb:20]:
"User.count" didn't change by 1.
<3> expected but was
<2>.
14 tests, 19 assertions, 1 failures, 0 errors
Errors running test:functionals! #<#<Class:0x472b82e5>: Command failed with stat
us (1): [c:/jruby-1.6.7.2/bin/jruby.exe -I"lib;test...]>
I already check the log file looking for SQL errors but everything seems ok.
Any idea why is this failing?
I assume that you haven't changed the test file, and it was automatically generated.
In this case, because there are no SQL errors, there must have been a problem with the test and/or the controller.
Assuming there is nothing wrong with the controller, the likely problems are:
the values of the attributes your test is sending to the controller are not valid (due to validation in your model)
the test is not authorized to create the object (if you are using devise, you need to sign in within the test)
Otherwise, the controller might have a bug.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.