Skip to content

Instantly share code, notes, and snippets.

@jnwheeler44
Created September 18, 2012 19:12
Show Gist options
  • Save jnwheeler44/3745167 to your computer and use it in GitHub Desktop.
Save jnwheeler44/3745167 to your computer and use it in GitHub Desktop.
Factory.sequence :email do |n|
"test#{n}@example.com"
end
Factory.sequence :username do |n|
"user#{n}"
end
Factory.sequence :visitor_token do |n|
"token#{n}"
end
Factory.define :user do |u|
u.email { Factory.next(:email) }
u.visitor_token { Factory.next(:visitor_token) }
u.password "secret"
u.password_confirmation {|u| u.password }
end
Factory.define :active_user, :parent => :user do |u|
u.after_build do |u|
u.confirm!
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment