Sha256: f690a8c267e9f10b4d3949333703af3fcff75fe0371981b14df1bfdd4ad4ad06

Contents?: true

Size: 429 Bytes

Versions: 3

Compression:

Stored size: 429 Bytes

Contents

FactoryGirl.define do
  factory :user_role, class: 'Mks::Auth::UserRole' do
    name { FFaker::Name.name }

    trait :with_menu do
      after(:create) do |role|
        role.menus << create(:menu, text: 'menu1')
      end
    end

    trait :with_menus do
      after(:create) do |role|
        role.menus = [create(:menu, text: 'menu1'), create(:menu, text: 'menu2'), create(:menu, text: 'menu3')]
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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