Class: BarAbility

Inherits:
Object
  • Object
show all
Includes:
CanCan::Ability
Defined in:
lib/spree/testing_support/bar_ability.rb

Overview

Fake ability for testing administration

Instance Method Summary collapse

Constructor Details

#initialize(user) ⇒ BarAbility

Returns a new instance of BarAbility.



5
6
7
8
9
10
11
12
13
# File 'lib/spree/testing_support/bar_ability.rb', line 5

def initialize(user)
  user ||= Spree::User.new
  if user.has_spree_role? 'bar'
    # allow dispatch to :admin, :index, and :show on Spree::Order
    can [:admin, :index, :show], Spree::Order
    # allow dispatch to :index, :show, :create and :update shipments on the admin
    can [:admin, :manage], Spree::Shipment
  end
end