当我尝试运行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我不明白为什么运行这个测试与创建银行有任何关系。有人能解释这是怎么回事吗?
发布于 2011-01-15 03:21:32
您使用的是灯具吗?如果是,请仔细检查您的fixture中的数据是否没有违反一个(或多个)数据库表上的唯一性约束。
我以前在创建具有唯一索引的表时遇到过这个问题:
create_table "companies" do |t|
t.string "name"
t.text "description"
end
add_index "companies", "name", :unique => true默认情况下,此模型的fixture将使用name属性的非惟一数据生成。
发布于 2011-01-15 21:55:46
我假设这是一个新的测试套件,并且您还没有使用实际数据更新您的fixtures/bank.yml文件,并且您可能实际上也有一个ID字段,也许吧?
在没有看到那个装置的情况下,这一切都是猜测工作,但看看这个。
https://stackoverflow.com/questions/4694423
复制相似问题