Sha256: 0ab767ac53ee15df69350dcfc05f2f52b968474de169bf7590c6d8299e989cfc

Contents?: true

Size: 871 Bytes

Versions: 8

Compression:

Stored size: 871 Bytes

Contents

# frozen_string_literal: true

require 'factory_bot'
require 'securerandom'

FactoryBot.define do
  factory :meibo_role, class: 'Meibo::Role' do
    initialize_with { new(**attributes) }

    transient do
      user { nil }
      organization { nil }
      user_profile { nil }
    end

    sourced_id { SecureRandom.uuid }
    user_sourced_id { user&.sourced_id }
    org_sourced_id { organization&.sourced_id }
    user_profile_sourced_id { user_profile&.sourced_id }

    trait :primary do
      role_type { Meibo::Role::TYPES[:primary] }
    end

    trait :secondary do
      role_type { Meibo::Role::TYPES[:secondary] }
    end

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

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

    trait :guardian do
      role { Meibo::Role::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/role.rb
meibo-0.7.0 lib/meibo/factory_bot/role.rb
meibo-0.6.0 lib/meibo/factory_bot/role.rb
meibo-0.5.0 lib/meibo/factory_bot/role.rb
meibo-0.4.0 lib/meibo/factory_bot/role.rb
meibo-0.3.0 lib/meibo/factory_bot/role.rb
meibo-0.2.0 lib/meibo/factory_bot/role.rb
meibo-0.1.0 lib/meibo/factory_bot/role.rb