Module: Spree::TestingSupport::AuthorizationHelpers::CustomAbility

Included in:
Controller, Request
Defined in:
lib/spree/testing_support/authorization_helpers.rb

Instance Method Summary collapse

Instance Method Details

#build_permission_set(&block) ⇒ Object



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

def build_permission_set(&block)
  block ||= proc { |_u| can :manage, :all }
  Class.new(Spree::PermissionSets::Base) do
    define_method(:activate!) do
      instance_exec(user, &block)
    end
  end
end