Sha256: 76e051fbd3d87f217e93296bd5b505c9f4de04e953393ecba733df55a2df555e

Contents?: true

Size: 729 Bytes

Versions: 7

Compression:

Stored size: 729 Bytes

Contents

# frozen_string_literal: true

require 'factory_bot'
require 'securerandom'

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

    transient do
      user { nil }
    end

    sourced_id { user&.sourced_id || SecureRandom.uuid }

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

    trait :male do
      sex { Meibo::Demographic::SEX[:male] }
    end

    trait :female do
      sex { Meibo::Demographic::SEX[:female] }
    end

    trait :unspecified do
      sex { Meibo::Demographic::SEX[:unspecified] }
    end

    trait :other do
      sex { Meibo::Demographic::SEX[:other] }
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

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