Skip to content

Instantly share code, notes, and snippets.

@dreamr
Created June 1, 2011 21:38
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 dreamr/1003388 to your computer and use it in GitHub Desktop.
Save dreamr/1003388 to your computer and use it in GitHub Desktop.
require 'faker'
require "#{Rails.root}/app/lib/railstar_lib/data/masked_field"
require "#{Rails.root}/spec/support/factory_sequences"
include RailstarLib::Data
Factory.define :user do |u|
u.name { Faker::Name.name }
u.email { Factory.next(:email) }
u.password "password"
u.password_confirmation {|user| user.password }
end
User.available_roles.each do |role|
Factory.define role, :parent => :user do |u|
u.roles_mask { MaskedField.mask([{role.to_s=>role}], User.available_roles) }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment