2011-01-14 121 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字段,也許?

沒有看到夾具,這都是猜測工作,但看看這個。

相關問題