Skip to content

Instantly share code, notes, and snippets.

@darkside
Created January 21, 2015 20:44
Show Gist options
  • Save darkside/f243a84544a516788859 to your computer and use it in GitHub Desktop.
Save darkside/f243a84544a516788859 to your computer and use it in GitHub Desktop.
Spec helper creating seeds
config.before :suite do
# Make sure we cleanup (if anything went wrong it could leave the DB
# in a dirty state)
DatabaseCleaner.clean_with :truncation
# Create a master company.
master_company = FactoryGirl::SeedGenerator.create :master_company
Role.available_roles.each do |r|
# Create roles and a default user for each role
FactoryGirl::SeedGenerator.create :"#{r}_role"
FactoryGirl::SeedGenerator.create r
end
FactoryGirl::SeedGenerator.create :master_order
FactoryGirl::SeedGenerator.create :product
FactoryGirl::SeedGenerator.create :category
FactoryGirl::SeedGenerator.create :location
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment