MARUGOSHI.ORG

How to use seeds during test

I want to use seed data with feature test like Request Spec and I find a good answer.

# {Rails.root}/spec/spec_helper.rb

Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}

Rspec.configure do |config|
end

In support file, just require seeds.rb.

# {Rails.root}/spec/support/ext/seeds.rb

require Rails.root.join("db", "seeds")