Sha256: 2bb1bd57d4a822cefd8f5c93b7596262edb54a2f7f3dbb96b544cff3b6dbf7ff

Contents?: true

Size: 768 Bytes

Versions: 8

Compression:

Stored size: 768 Bytes

Contents

# frozen_string_literal: true

require 'factory_bot'
require 'securerandom'

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

    transient do
      agents { [] }
      primary_organization { nil }
    end

    sourced_id { SecureRandom.uuid }
    sequence(:username) {|n| "user#{n}@example.com" }
    sequence(:given_name) {|n| "John#{n}" }
    sequence(:family_name) {|n| "Doe#{n}" }
    agent_sourced_ids { agents&.map(&:sourced_id) }
    primary_org_sourced_id { primary_organization&.sourced_id }

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

      transient do
        homeroom { nil }
      end

      home_class { homeroom&.sourced_id }
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
meibo-0.16.0 lib/meibo/factory_bot/user.rb
meibo-0.15.0 lib/meibo/factory_bot/user.rb
meibo-0.14.0 lib/meibo/factory_bot/user.rb
meibo-0.13.0 lib/meibo/factory_bot/user.rb
meibo-0.12.0 lib/meibo/factory_bot/user.rb
meibo-0.11.0 lib/meibo/factory_bot/user.rb
meibo-0.10.0 lib/meibo/factory_bot/user.rb
meibo-0.9.0 lib/meibo/factory_bot/user.rb