Sha256: 4eeb00b708b40b181ed917d51dea643bdd47cb30610dc40b138de847cffabcc6
Contents?: true
Size: 1.54 KB
Versions: 2
Compression:
Stored size: 1.54 KB
Contents
FactoryGirl.define do factory :program do to_create { |instance| instance.save } sequence(:name) { |num| "Program #{num}" } trait :with_graph do courses_attributes { attributes_for_list(:course, 3, :with_graph) } end end factory :course do to_create { |instance| instance.save } sequence(:name) { |num| "Course #{num}" } trait :with_graph do assignments_attributes { attributes_for_list(:assignment, 3) } enrollments_attributes { attributes_for_list(:enrollment, 3, :with_graph) } categories_attributes { attributes_for_list(:category, 3) } end end factory :assignment do to_create { |instance| instance.save } sequence(:name) { |num| "Assignment #{num}" } end factory :student do to_create { |instance| instance.save } sequence(:name) { |num| "Student #{num}" } trait :with_graph do profile_attributes { attributes_for(:profile) } account_attributes { attributes_for(:account) } end end factory :account do to_create { |instance| instance.save } sequence(:email) { |num| "student-#{num}@example.com" } end factory :profile do to_create { |instance| instance.save } sequence(:bio) { |num| "Student #{num}: lorem ipsum..." } end factory :enrollment do to_create { |instance| instance.save } trait :with_graph do student_attributes { attributes_for(:student, :with_graph) } end end factory :category do to_create { |instance| instance.save } sequence(:name) { |num| "Category #{num}" } end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sequel_deep_dup-0.2.2 | spec/support/factories.rb |
sequel_deep_dup-0.2.1 | spec/support/factories.rb |