0
如果我使用rake cucumber
夾具未加載,我的測試失敗。如果我使用cucumber --tag @tagname
來運行一個場景,它會加載燈具,工廠和其他所有東西。耙黃瓜和黃瓜--tag @tagname給出不同的結果
我/features/support/env.rb
的底部看起來是這樣的:
Cucumber::Rails::World.use_transactional_fixtures = true
Fixtures.reset_cache
fixtures_folder = File.join(RAILS_ROOT, 'spec', 'fixtures')
fixtures = Dir[File.join(fixtures_folder, '*.yml')].map {|f| File.basename(f, '.yml') }
Fixtures.create_fixtures(fixtures_folder, fixtures)
if defined?(ActiveRecord::Base)
begin
require 'database_cleaner'
DatabaseCleaner.strategy = :truncation
rescue LoadError => ignore_if_database_cleaner_not_present
end
end
一切是相當標準的Rails 3