Sha256: b2c344e0b3ba6fff568456754dd3275090b26e51fd67a6fe504ccc538ff93265

Contents?: true

Size: 1.04 KB

Versions: 15

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true

require "factory_bot"
require "securerandom"

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

    transient do
      today { Date.today }
      parent { nil }
    end

    sourced_id { SecureRandom.uuid }
    title { "#{school_year}年度" }
    type { Meibo::AcademicSession::TYPES[:school_year] }
    start_date { Date.new(school_year, 4, 1) }
    end_date { Date.new(school_year + 1, 3, 31) }
    parent_sourced_id { parent&.sourced_id }
    school_year { today.year }

    trait :grading_period do
      type { Meibo::AcademicSession::TYPES[:grading_period] }
    end

    trait :semester do
      type { Meibo::AcademicSession::TYPES[:semester] }
    end

    trait :school_year do
      type { Meibo::AcademicSession::TYPES[:school_year] }
    end

    trait :term do
      type { Meibo::AcademicSession::TYPES[:term] }
    end

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

Version data entries

15 entries across 15 versions & 1 rubygems

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