Sha256: 09809058553d0bcabdd50c3bea39083c32e283995a5c6e01d025c24a7173ba00

Contents?: true

Size: 808 Bytes

Versions: 8

Compression:

Stored size: 808 Bytes

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 :student do
      role { Meibo::Enrollment::ROLES[:student] }
    end

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

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

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

Version data entries

8 entries across 8 versions & 1 rubygems

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