當我運行「耙測試」不加載裝置?
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)
,爲什麼不把它加載夾具會發生什麼(我認爲這將是默認行爲),我如何讓它執行測試前加載燈具? ??
p.s.
我的測試/ 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)
對於它的價值,我遇到了類似的問題,除了我定義了一個依賴於數據庫記錄的常量。將該常量移至實例變量和booya。乾杯。 – 2011-03-01 19:34:24