Skip to content

Instantly share code, notes, and snippets.

@apraditya
Created May 25, 2012 04:40
Show Gist options
  • Save apraditya/2785803 to your computer and use it in GitHub Desktop.
Save apraditya/2785803 to your computer and use it in GitHub Desktop.
factory definition
Factory.define :user do |u|
u.password 'password'
u.password_confirmation { |u| u.password }
u.confirmation_sent_at Time.new
u.confirmed_at Time.new
u.location 'US'
end
Factory.define :admin, :parent => :user do |admin|
admin.sequence(:name) { |n| "Admin #{n}" }
admin.sequence(:email) { |n| "admin.#{n}@email.com" }
admin.role 'admin'
end
Factory.define :member, :parent => :user do |member|
member.sequence(:name) { |n| "Member #{n}" }
member.sequence(:email) { |n| "member.#{n}@email.com" }
member.role 'member'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment