我得到 this error当我尝试运行 rake test:profile
时。错误来自此文件中的 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
我不明白为什么运行此测试与创建银行有任何关系。谁能解释一下这是怎么回事?
最佳答案
你在使用固定装置吗?如果是这样,请仔细检查您的设备中的数据是否违反了一个(或多个)数据库表的唯一性约束。
我以前在创建具有唯一索引的表时遇到过这个问题:
create_table "companies" do |t|
t.string "name"
t.text "description"
end
add_index "companies", "name", :unique => true
默认情况下,此模型的夹具将使用 name
属性的非唯一数据生成。
关于ruby-on-rails - 运行测试时出现莫名其妙的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4694423/