Skip to content

Instantly share code, notes, and snippets.

@hosh
Created April 19, 2010 19:19
Show Gist options
  • Save hosh/371461 to your computer and use it in GitHub Desktop.
Save hosh/371461 to your computer and use it in GitHub Desktop.
require 'machinist/active_record'
require 'sham'
require 'faker'
# The one below is from an older version. In my newer version that works with rspec2,
# blueprints.rb is located in spec/support and the line below matches that. The advantage
# is that the generated spec_helper automatically loads anything under spec/support
require File.expand_path('blueprints.rb', File.dirname(__FILE__) + '/../spec/')
puts '', "Accounts ..."
account = Account.make
puts account.name
puts '', "Manufacturers ..."
5.times do
m = Manufacturer.make(:account => account)
puts m.name
end
puts '', "Merchants ..."
10.times do
m = Merchant.make(:account => account)
puts m.name
end
puts '', "Contacts ..."
3.times do
contact = Contact.make
account.account_contacts.create(:contact => contact)
puts "#{contact.last_name}, #{contact.first_name} <#{contact.email}>"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment