Sha256: 1a7a2f6c75cb08695ca210bf5bbb6f6a0fa4b20a8c9c5f1419ec04066c7598b3

Contents?: true

Size: 765 Bytes

Versions: 3

Compression:

Stored size: 765 Bytes

Contents

FactoryGirl.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) }
    association :application_module

    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

3 entries across 3 versions & 1 rubygems

Version Path
mks_auth-1.4.0 spec/factories/users.rb
mks_auth-1.2.0 spec/factories/users.rb
mks_auth-1.0.0 spec/factories/users.rb