My student_status id's store different associations. For instance, student_status_id of 1 means the student is active, so it is integral that I generate these different id's. I've tried creating a FactoryGirl user without the student_status_id 1 and the code breaks telling me that there is no status_id. Furthermore, how do I use FactoryGirl to generate say a status_id of say 7?
FactoryGirl.define do
factory :user do
first_name 'example'
last_name 'user'
email 'example@user.com'
username 'example'
password 'abcdef'
password_confirmation 'abcdef'
birthdate DateTime.new(1990,9,1,17)
student
end
end
FactoryGirl.define do
factory :student_status do
name 'Active'
student
end
end
FactoryGirl.define do
factory :student do
points 20
session_minutes 120
weekly_session_minutes 120
can_schedule_self false
next_monthly_cycle DateTime.new(2015,9,1,17)
student_status_id 1
end
end
Aucun commentaire:
Enregistrer un commentaire