Sha256: fae11cfdc2339076cf0806ca99361a0efde0de60a852af0f4c421b483bc06358

Contents?: true

Size: 615 Bytes

Versions: 8

Compression:

Stored size: 615 Bytes

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).iso8601 }
    end_date { Date.new(school_year + 1, 3, 31).iso8601 }
    parent_sourced_id { parent&.sourced_id }
    school_year { today.year }
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
meibo-0.8.0 lib/meibo/factory_bot/academic_session.rb
meibo-0.7.0 lib/meibo/factory_bot/academic_session.rb
meibo-0.6.0 lib/meibo/factory_bot/academic_session.rb
meibo-0.5.0 lib/meibo/factory_bot/academic_session.rb
meibo-0.4.0 lib/meibo/factory_bot/academic_session.rb
meibo-0.3.0 lib/meibo/factory_bot/academic_session.rb
meibo-0.2.0 lib/meibo/factory_bot/academic_session.rb
meibo-0.1.0 lib/meibo/factory_bot/academic_session.rb