Created
January 21, 2015 20:44
-
-
Save darkside/f243a84544a516788859 to your computer and use it in GitHub Desktop.
Spec helper creating seeds
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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