Skip to content

Instantly share code, notes, and snippets.

@tdouce
Last active December 23, 2015 22:49
Show Gist options
  • Save tdouce/6705737 to your computer and use it in GitHub Desktop.
Save tdouce/6705737 to your computer and use it in GitHub Desktop.
# spec/factories/users.rb
FactoryGirl.define do
factory :user do
sequence(:email) { |n| "user#{n}@bignerdranch.com" }
sequence(:username) { |n| "user#{n}" }
password 'test123'
password_confirmation 'test123'
terms_of_use true
confirmed_at Time.now
role 'teacher'
association :teacher, factory: :teacher
end
factory :lite_user, parent: :user do
email '[email protected]'
account_type 'lite'
confirmed_at Time.now
end
factory :student_user, parent: :user do
role User::STUDENT
association :student, factory: :student
end
end
# spec/factories/teachers.rb
FactoryGirl.define do
factory :teacher do
account_type Teacher::LITE
viewed_tutorial true
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment