Sha256: 7e29f6afbbb9e7b1aaca672845c3b7c7371e501c2d2e0e547433378875c8766a

Contents?: true

Size: 533 Bytes

Versions: 16

Compression:

Stored size: 533 Bytes

Contents

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

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

FactoryGirl.define do
  [:index, :show, :update, :create, :destroy].each do |action|
    factory "#{action}_group".to_sym, :class => 'Faalis::Permission' do
      model 'Faalis::Group'
      permission_type action
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
faalis-2.0.8 spec/factories/faalis/permissions.rb
faalis-2.0.7 spec/factories/faalis/permissions.rb
faalis-2.0.5 spec/factories/faalis/permissions.rb
faalis-2.0.4 spec/factories/faalis/permissions.rb
faalis-2.0.3 spec/factories/faalis/permissions.rb
faalis-2.0.1 spec/factories/faalis/permissions.rb
faalis-2.0.0 spec/factories/faalis/permissions.rb
faalis-2.0.0.rc6 spec/factories/faalis/permissions.rb
faalis-2.0.0.rc5 spec/factories/faalis/permissions.rb
faalis-2.0.0.rc4 spec/factories/faalis/permissions.rb
faalis-2.0.0.rc3 spec/factories/faalis/permissions.rb
faalis-2.0.0.rc2 spec/factories/faalis/permissions.rb
faalis-1.0.0 spec/factories/faalis/permissions.rb
faalis-1.0.0.alpha4 spec/factories/faalis/permissions.rb
faalis-1.0.0.alpha3 spec/factories/faalis/permissions.rb
faalis-1.0.0.alpha2 spec/factories/faalis/permissions.rb