我跑:
ruby -I test test/unit/job_test.rb
从我的应用程序根目录,我得到:
Loaded suite test/unit/job_test Started E Finished in 2.046875 seconds. 1) Error: test_My_First_Test(JobTest): ActiveRecord::RecordNotUnique: MysqL2::Error: Duplicate entry '' for key 'name': INSERT INTO `ac_buyers` (`created_at`,`updated_at`,`id`) VALUES ('2011-03-10 06:04:06','2011-03-10 06:04:06',298486374)
这里发生了什么 ?
为什么Rails尝试将值插入数据库?
这是test / unit / job_test.rb:
require 'test_helper' class JobTest < ActiveSupport::TestCase test "My First Test" do assert false end end