Module: Spree::TestingSupport::AuthorizationHelpers::Controller Private

Includes:
CustomAbility
Defined in:
lib/spree/testing_support/authorization_helpers.rb

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Methods included from CustomAbility

#build_ability

Instance Method Details

#stub_authorization!(&block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



17
18
19
20
21
22
# File 'lib/spree/testing_support/authorization_helpers.rb', line 17

def stub_authorization!(&block)
  ability_class = build_ability(&block)
  before do
    allow(controller).to receive(:current_ability).and_return(ability_class.new(nil))
  end
end