我只是在运行在rails中创建脚手架时构建的功能测试。但是,当我尝试进行rake测试时,所有测试都会弹出以下错误(即使是像get index这样的测试)
编辑:似乎测试试图插入用户数据库而不是注释。知道为什么会这样吗?
test_should_update_note(NotesControllerTest):
ActiveRecord::StatementInvalid: SQLite3::ConstraintException: constraint failed: INSERT INTO "users" ("created_at", "updated_at", "id") VALUES ('2013-04-08 00:16:46', '2013-04-08 00:16:46', 298486374)
/Users/vicli/.rvm/gems/ruby-1.9.3-p362/gems/sqlite3-1.3.7/lib/sqlite3/statement.rb:108:in `step'
/Users/vicli/.rvm/gems/ruby-1.9.3-p362/gems/sqlite3-1.3.7/lib/sqlite3/statement.rb:108:in `block in each'
/Users/vicli/.rvm/gems/ruby-1.9.3-p362/gems/sqlite3-1.3.7/lib/sqlite3/statement.rb:107:in `loop'
/Users/vicli/.rvm/gems/ruby-1.9.3-p362/gems/sqlite3-1.3.7/lib/sqlite3/statement.rb:107:in `each'
/Users/vicli/.rvm/gems/ruby-1.9.3-p362/gems/sqlite3-1.3.7/lib/sqlite3/database.rb:149:in `map'
/Users/vicli/.rvm/gems/ruby-1.9.3-p362/gems/sqlite3-1.3.7/lib/sqlite3/database.rb:149:in `block in execute'
/Users/vicli/.rvm/gems/ruby-1.9.3-p362/gems/sqlite3-1.3.7/lib/sqlite3/database.rb:95:in `prepare'
/Users/vicli/.rvm/gems/ruby-1.9.3-p362/gems/sqlite3-1.3.7/lib/sqlite3/database.rb:134:in `execute'
/Users/vicli/.rvm/gems/ruby-1.9.3-p362/gems/activerecord-3.2.11/lib/active_record/connection_adapters/sqlite_adapter.rb:278:in `block in execute'
/Users/vicli/.rvm/gems/ruby-1.9.3-p362/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract_adapter.rb:280:in `block in log'
/Users/vicli/.rvm/gems/ruby-1.9.3-p362/gems/activesupport-3.2.11/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/Users/vicli/.rvm/gems/ruby-1.9.3-p362/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract_adapter.rb:275:in `log'
/Users/vicli/.rvm/gems/ruby-1.9.3-p362/gems/activerecord-3.2.11/lib/active_record/connection_adapters/sqlite_adapter.rb:278:in `execute'
/Users/vicli/.rvm/gems/ruby-1.9.3-p362/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/database_statements.rb:277:in `insert_fixture'
/Users/vicli/.rvm/gems/ruby-1.9.3-p362/gems/activerecord-3.2.11/lib/active_record/fixtures.rb:502:in `block (5 levels) in create_fixtures'
/Users/vicli/.rvm/gems/ruby-1.9.3-p362/gems/activerecord-3.2.11/lib/active_record/fixtures.rb:501:in `each'
/Users/vicli/.rvm/gems/ruby-1.9.3-p362/gems/activerecord-3.2.11/lib/active_record/fixtures.rb:501:in `block (4 levels) in create_fixtures'
/Users/vicli/.rvm/gems/ruby-1.9.3-p362/gems/activerecord-3.2.11/lib/active_record/fixtures.rb:500:in `each'
/Users/vicli/.rvm/gems/ruby-1.9.3-p362/gems/activerecord-3.2.11/lib/active_record/fixtures.rb:500:in `block (3 levels) in create_fixtures'
/Users/vicli/.rvm/gems/ruby-1.9.3-p362/gems/activerecord-3.2.11/lib/active_record/fixtures.rb:492:in `each'
/Users/vicli/.rvm/gems/ruby-1.9.3-p362/gems/activerecord-3.2.11/lib/active_record/fixtures.rb:492:in `block (2 levels) in create_fixtures'
/Users/vicli/.rvm/gems/ruby-1.9.3-p362/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
/Users/vicli/.rvm/gems/ruby-1.9.3-p362/gems/activerecord-3.2.11/lib/active_record/fixtures.rb:491:in `block in create_fixtures'
/Users/vicli/.rvm/gems/ruby-1.9.3-p362/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract_adapter.rb:168:in `disable_referential_integrity'
/Users/vicli/.rvm/gems/ruby-1.9.3-p362/gems/activerecord-3.2.11/lib/active_record/fixtures.rb:476:in `create_fixtures'
/Users/vicli/.rvm/gems/ruby-1.9.3-p362/gems/activerecord-3.2.11/lib/active_record/fixtures.rb:895:in `load_fixtures'
/Users/vicli/.rvm/gems/ruby-1.9.3-p362/gems/activerecord-3.2.11/lib/active_record/fixtures.rb:849:in `setup_fixtures'
/Users/vicli/.rvm/gems/ruby-1.9.3-p362/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:429:in `_run__412855329189462788__setup__2162806003840848912__callbacks'
/Users/vicli/.rvm/gems/ruby-1.9.3-p362/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:405:in `__run_callback'
/Users/vicli/.rvm/gems/ruby-1.9.3-p362/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:385:in `_run_setup_callbacks'
/Users/vicli/.rvm/gems/ruby-1.9.3-p362/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:81:in `run_callbacks'
/Users/vicli/.rvm/gems/ruby-1.9.3-p362/gems/activesupport-3.2.11/lib/active_support/testing/setup_and_teardown.rb:35:in `run'
我不明白为什么约束失败,因为当我手动测试一切正常时,这些值确实存储在数据库中