Sha256: 51391e23f361cb8018440cdfd307c49461e27c78df94c2e663d5e70167f029aa

Contents?: true

Size: 732 Bytes

Versions: 12

Compression:

Stored size: 732 Bytes

Contents

FactoryBot.define do
  factory :user, class: 'Mks::Auth::User' do
    first_name { FFaker::Name.name }
    last_name { FFaker::Name.name }
    email { FFaker::Internet.email }
    active { true }
    password { FFaker::Internet.password(min_length=6) }

    trait :with_role do
      after(:create) do |user|
        user.roles << create(:user_role, name: 'role1')
      end
    end

    trait :with_role_and_menus do
      after(:create) do |user|
        user.roles << create(:user_role, :with_menus)
      end
    end

    trait :with_roles do
      after(:create) do |user|
        user.roles = [create(:user_role, name: 'role1'), create(:user_role, name: 'role2'), create(:user_role, name: 'role3')]
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 5 rubygems

Version Path
mks_auth-1.0.14 spec/factories/users.rb
mks_rent-1.0.0 spec/factories/users.rb
mks_maintenance-1.0.0 spec/factories/users.rb
mks_rate-1.0.5 spec/factories/users.rb
mks_edm-1.0.5 spec/factories/users.rb
mks_rate-1.0.4 spec/factories/users.rb
mks_edm-1.0.4 spec/factories/users.rb
mks_rate-1.0.3 spec/factories/users.rb
mks_rate-1.0.2 spec/factories/users.rb
mks_edm-1.0.2 spec/factories/users.rb
mks_rate-1.0.1 spec/factories/users.rb
mks_edm-1.0.1 spec/factories/users.rb