2011-01-14 125 views
0

我试着运行rake test:profile时得到this error。该错误是由test_homepage这是在这个文件来:运行测试时出现意外错误

require 'test_helper' 
require 'rails/performance_test_help' 

# Profiling results for each test method are written to tmp/performance. 
class BrowsingTest < ActionDispatch::PerformanceTest 
    def test_homepage 
    get '/' 
    end 
end 

我不明白为什么运行这个测试有什么关系创造了银行。任何人都可以解释发生了什么?

+0

你可以发布你的db/seeds.rb文件吗? – 2011-01-14 19:12:32

回答

1

您是否在使用灯具?如果是这样,仔细检查一下,看看你的灯具中的数据没有违反一个(或多个)数据库表上的唯一性约束。

我已经与唯一索引创建表时本次发行前:

create_table "companies" do |t| 
    t.string "name" 
    t.text  "description" 
end 

add_index "companies", "name", :unique => true 

默认情况下,将与为name属性非唯一数据获取生成此模型的夹具。

0

我认为这是一个新的测试套件,你没有更新你的fixtures/bank.yml文件与真实数据,你可能实际上也有一个ID字段,也许?

没有看到夹具,这都是猜测工作,但看看这个。

相关问题