Skip to content

Instantly share code, notes, and snippets.

@jwulff
Created September 16, 2011 18:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jwulff/1222772 to your computer and use it in GitHub Desktop.
Save jwulff/1222772 to your computer and use it in GitHub Desktop.
require 'factory_girl_rails'
FactoryGirl.define do
BLUTHS = [ 'Annyong',
'Buster',
'George',
'George Michael',
'Gob',
'Lindsay',
'Lucille',
'Maeby',
'Michael',
'Oscar',
'Tobias' ]
FactoryGirl.define do
sequence(:email) { |n| "#{BLUTHS[n].downcase.gsub(' ', '_')}@bluth.com" }
sequence(:first_name) { |n| BLUTHS[n] }
end
factory :user do
email
password 'babybuster'
first_name
last_name 'Bluth'
end
factory :organization do
association :owner, :factory => :user
name 'Bluth Company'
subdomain 'bluth'
end
factory :organization_user do
organization
user
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment