Errors running test:units! #<RuntimeError: Command failed with status (1): [ruby -I"lib:test" -I"/Users/jake/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.2/lib" "/Users/jake/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.2/lib/rake/rake_test_loader.rb" "test/unit/**/*_test.rb" ]>
这是否意味着我的单元测试文件有问题,或者我的模型有问题?或者两者都可以?
下面的完整跟踪。
[app:]$ rake test --trace
** Invoke test (first_time)
** Execute test
** Invoke test:run (first_time)
** Execute test:run
** Invoke test:units (first_time)
** Invoke test:prepare (first_time)
** Invoke db:test:prepare (first_time)
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:abort_if_pending_migrations
** Execute db:test:prepare
** Invoke db:test:load (first_time)
** Invoke db:test:purge (first_time)
** Invoke environment
** Invoke db:load_config
** Execute db:test:purge
** Execute db:test:load
** Invoke db:test:load_schema (first_time)
** Invoke db:test:purge
** Execute db:test:load_schema
** Invoke db:schema:load (first_time)
** Invoke environment
** Invoke db:load_config
** Execute db:schema:load
** Execute test:prepare
** Execute test:units
Run options:
# Running tests:
..F
Finished tests in 0.411867s, 7.2839 tests/s, 7.2839 assertions/s.
1) Failure:
test_should_save_user_with_valid_email_and_password(UserTest) [/Users/jake/Sites/app/test/unit/user_test.rb:9]:
Didn't save a valid record
3 tests, 3 assertions, 1 failures, 0 errors, 0 skips
** Invoke test:functionals (first_time)
** Invoke test:prepare
** Execute test:functionals
Run options:
# Running tests:
Finished tests in 0.004578s, 0.0000 tests/s, 0.0000 assertions/s.
0 tests, 0 assertions, 0 failures, 0 errors, 0 skips
** Invoke test:integration (first_time)
** Invoke test:prepare
** Execute test:integration
Errors running test:units! #<RuntimeError: Command failed with status (1): [ruby -I"lib:test" -I"/Users/jake/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.2/lib" "/Users/jake/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.2/lib/rake/rake_test_loader.rb" "test/unit/**/*_test.rb" ]>
编辑
此错误仅在 rake 返回错误时出现。如果没有错误,这个运行测试的错误也不会出现......好奇和好奇......