Sha256: 006df3e8dc3c461d54e306020d22ee6a87187de181b57056c673c712029cffca

Contents?: true

Size: 979 Bytes

Versions: 15

Compression:

Stored size: 979 Bytes

Contents

# frozen_string_literal: true

require "factory_bot"
require "securerandom"

FactoryBot.define do
  factory :meibo_classroom, class: "Meibo::Classroom" do
    initialize_with { new(**attributes) }

    transient do
      course { nil }
      school { nil }
      terms { [] }
    end

    sourced_id { SecureRandom.uuid }
    sequence(:title) { |n| "#{n}組" }
    course_sourced_id { course&.sourced_id }
    class_type { Meibo::Classroom::TYPES[:homeroom] }
    school_sourced_id { school&.sourced_id }
    term_sourced_ids { terms.map(&:sourced_id) }

    trait :homeroom do
      class_type { Meibo::Classroom::TYPES[:homeroom] }
    end

    trait :scheduled do
      class_type { Meibo::Classroom::TYPES[:scheduled] }
    end

    trait :jp do
      initialize_with { Meibo::JapanProfile::Classroom.new(**attributes) }
    end

    trait :special_needs do
      special_needs { true }
    end

    trait :no_special_needs do
      special_needs { false }
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
meibo-0.27.1 lib/meibo/factory_bot/classroom.rb
meibo-0.27.0 lib/meibo/factory_bot/classroom.rb
meibo-0.26.0 lib/meibo/factory_bot/classroom.rb
meibo-0.25.3 lib/meibo/factory_bot/classroom.rb
meibo-0.25.2 lib/meibo/factory_bot/classroom.rb
meibo-0.25.1 lib/meibo/factory_bot/classroom.rb
meibo-0.25.0 lib/meibo/factory_bot/classroom.rb
meibo-0.24.0 lib/meibo/factory_bot/classroom.rb
meibo-0.23.0 lib/meibo/factory_bot/classroom.rb
meibo-0.22.0 lib/meibo/factory_bot/classroom.rb
meibo-0.21.0 lib/meibo/factory_bot/classroom.rb
meibo-0.20.0 lib/meibo/factory_bot/classroom.rb
meibo-0.19.0 lib/meibo/factory_bot/classroom.rb
meibo-0.18.0 lib/meibo/factory_bot/classroom.rb
meibo-0.17.0 lib/meibo/factory_bot/classroom.rb