Skip to content

Commit

Permalink
Remove last occurrence of BarAbility
Browse files Browse the repository at this point in the history
It's deprecated but the deprecation message was silenced for some
reason. This commit allow us to avoid using that class switching
to an anonymous class that does the same.
  • Loading branch information
kennyadsl committed Nov 25, 2020
1 parent 472677c commit dd02ab2
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion core/spec/models/spree/ability_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,17 @@ def initialize(_user)
it 'should be able to admin on the order and shipment pages' do
user.spree_roles << Spree::Role.find_or_create_by(name: 'bar')

Spree::Ability.register_ability(BarAbility)
bar_ability = Class.new do
include CanCan::Ability

def initialize(user)
if user.has_spree_role? 'bar'
can [:admin, :index, :show], Spree::Order
can [:admin, :manage], Spree::Shipment
end
end
end
Spree::Ability.register_ability(bar_ability)

expect(ability).not_to be_able_to :admin, resource

Expand Down

0 comments on commit dd02ab2

Please sign in to comment.