-
Notifications
You must be signed in to change notification settings - Fork 3
Configuration file
baban edited this page May 25, 2016
·
7 revisions
Document is now translating please wait....
In config/initializers/flextures.rb
, configuration file is exist.
Flextures::Configuration.configure do |config|
# Load and dump directory change "spec/fixtures/" to "test/fixtures/"
config.load_directory = "test/fixtures/"
config.dump_directory = "test/fixtures/"
end
option | description |
---|---|
fixture_load_directory | change data load directory(default "spec/fixtures/") |
fixture_dump_directory | change data dump directory(default "spec/fixtures/") |
init_all_tables | when you start flextures, before all table data clean?(default 'false') |
options | other options |
table_load_order | high priority load table |
if this vale is 'true', all table data is truncated, before start flexture.
Flextures::Configuration.configure do |config|
config.init_all_tables = true
end
flextures default load option. options is same as Unittestsupport.
Flextures::Configuration.configure do |config|
config.options = { cache: true }
end
when you want to change table data load order,you use this option.
Flextures::Configuration.configure do |config|
config.table_load_order = ["item_masters"]
end
almost case you should not set this value. but few case is important load order.
for example, users table set factory load filter
Flextures::Factory.define :users do |f|
[1,5,8].each do |item_id|
f.items<< Item.new( item_master_id: item_id )
end
end
This case is insert items table data, when filter load users table data.
so, after users table data is loaded, load items.csv(or yml) data id column value conflict!
when you use factory load filter, you should attention to use ActiveRecord assosiation and master data load.
loading order is important.