Sha256: 04458b4826ad941dfe1a708d2af867e2eee1fa918b4cbe0f9e11ce9a761110db

Contents?: true

Size: 978 Bytes

Versions: 7

Compression:

Stored size: 978 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

7 entries across 7 versions & 1 rubygems

Version Path
meibo-0.16.0 lib/meibo/factory_bot/classroom.rb
meibo-0.15.0 lib/meibo/factory_bot/classroom.rb
meibo-0.14.0 lib/meibo/factory_bot/classroom.rb
meibo-0.13.0 lib/meibo/factory_bot/classroom.rb
meibo-0.12.0 lib/meibo/factory_bot/classroom.rb
meibo-0.11.0 lib/meibo/factory_bot/classroom.rb
meibo-0.10.0 lib/meibo/factory_bot/classroom.rb