Sha256: ab44489d750ba30124ab8e91eb627745fcd6957ec49ee8ffce2d3589771edeea

Contents?: true

Size: 1.08 KB

Versions: 13

Compression:

Stored size: 1.08 KB

Contents

# frozen_string_literal: true

require "factory_bot"
require "securerandom"

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

    transient do
      classroom { nil }
      school { nil }
      user { nil }
    end

    sourced_id { SecureRandom.uuid }
    class_sourced_id { classroom&.sourced_id }
    school_sourced_id { school&.sourced_id }
    user_sourced_id { user&.sourced_id }

    trait :administrator do
      role { Meibo::Enrollment::ROLES[:administrator] }
    end

    trait :proctor do
      role { Meibo::Enrollment::ROLES[:proctor] }
    end

    trait :student do
      role { Meibo::Enrollment::ROLES[:student] }
    end

    trait :teacher do
      role { Meibo::Enrollment::ROLES[:teacher] }
    end

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

    trait :guardian do
      role { Meibo::Enrollment::ROLES[:guardian] }
    end

    trait :public do
      public_flg { true }
    end

    trait :private do
      public_flg { false }
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

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