Sha256: 0674599b57a4500ba2b704eef378fd7a64fe46e9f15d9ba8684a899a02e23db0

Contents?: true

Size: 1007 Bytes

Versions: 6

Compression:

Stored size: 1007 Bytes

Contents

FactoryGirl.define do

  factory :program, class: Gaku::Program do
    name { FFaker::Education.degree }
    description 'Superior Ruby Skills'
    school
  end

  trait :full_program do |resource|
    resource.after(:build) do |program|
      level = create(:level)
      syllabus = create(:syllabus)
      specialty = create(:specialty)
      create(:program_level, level: level, program: program)
      create(:program_syllabus, level: level, program: program, syllabus: syllabus)
      create(:program_specialty, specialty: specialty, program: program)
    end
  end

  trait :with_program_level do |resource|
    resource.after(:build) do |program|
      program.levels << create(:level)
    end
  end

  trait :with_program_syllabus do |resource|
    resource.after(:build) do |program|
      program.syllabuses << create(:syllabus)
    end
  end

  trait :with_program_specialty do |resource|
    resource.after(:build) do |program|
      program.specialties << create(:specialty)
    end
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
gaku_core-0.3.0 lib/gaku/testing/factories/program_factory.rb
gaku_core-0.3.0.pre.4 lib/gaku/testing/factories/program_factory.rb
gaku_core-0.3.0.pre.3 lib/gaku/testing/factories/program_factory.rb
gaku_core-0.3.0.pre.2 lib/gaku/testing/factories/program_factory.rb
gaku_core-0.3.0.pre.1 lib/gaku/testing/factories/program_factory.rb
gaku_core-0.3.0.pre.0 lib/gaku/testing/factories/program_factory.rb