Sha256: 2bb338e10c5e0e91071a87219cf34ac9b051222c4bd808ad1a6f5c113a74d01c

Contents?: true

Size: 507 Bytes

Versions: 1

Compression:

Stored size: 507 Bytes

Contents

# Read about factories at https://github.com/thoughtbot/factory_girl

def define_permission(action, model)
  perm = Underworld::Permission.find_by(permission_type: action,
                                    model: "Underworld::#{model.to_s.titleize}")
  perm || Fabricate("#{action}_#{model}")
end

[:index, :show, :update, :create, :destroy].each do |action|
  Fabricator "#{action}_group".to_sym, class_name: 'Underworld::Permission' do
    model 'Underworld::Group'
    permission_type action
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
underworld-1.0.0 test/fabricators/underworld/permissions.rb