簡體   English   中英

“耙測試”不加載夾具嗎?

[英]“rake test” doesn't load fixtures?

當我跑步

rake test --trace

這是發生了什么

** Invoke test (first_time)
** Execute test
** Invoke test:units (first_time)
** Invoke db:test:prepare (first_time)
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:abort_if_pending_migrations
** Execute db:test:prepare
** Invoke db:test:load (first_time)
** Invoke db:test:purge (first_time)
** Invoke environment 
** Execute db:test:purge
** Execute db:test:load
** Invoke db:schema:load (first_time)
** Invoke environment 
** Execute db:schema:load
** Execute test:units
/usr/bin/ruby1.8 -I"lib:test".... (and after that fails because there's no fixtures loaded)

為什么不加載夾具(我認為這是默認行為),以及在執行測試之前如何使其加載夾具?

ps

我的test / test_helper.rb內容是:

ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require 'test_help'

class ActiveSupport::TestCase
 self.use_transactional_fixtures = true
 self.use_instantiated_fixtures  = false
 fixtures :all
end

(導軌2.3.4)

如果指定了夾具,則進行rake test加載夾具fixtures :all與您一樣。 燈具有什么問題嗎?

嘗試rake db:fixtures:load並檢查是否引發任何錯誤。

另外,我強烈建議跳過固定裝置,而選擇工廠。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM