[RSpec] Specifying Seed File Loading Path with SeedFu.fixture_paths for SeedFu.seed
In Ruby on Rails + RSpec, I operate by injecting initial data with SeedFu.seed before running tests.
When you want to change the seed file loading path, you can pass the path as an array to SeedFu.fixture_paths.
# spec/spec_helper.rb
RSpec.configure do |config|
# Seed_fu
config.before(:suite) do
SeedFu.fixture_paths = [
"#{Rails.root}/db/fixtures",
"#{Rails.root}/db/fixtures_initialization"
]
SeedFu.seed
end
end
[Reference]:mbleigh/seed-fu · GitHub
That’s all from the Gemba.