module Spree::TestingSupport::AuthorizationHelpers::Request

Public Instance Methods

custom_authorization!(&block) click to toggle source
# File lib/spree/testing_support/authorization_helpers.rb, line 50
def custom_authorization!(&block)
  ability = build_ability(&block)
  after(:all) do
    Spree::Ability.remove_ability(ability)
  end
  before(:all) do
    Spree::Ability.register_ability(ability)
  end
end
stub_authorization!() click to toggle source
# File lib/spree/testing_support/authorization_helpers.rb, line 32
def stub_authorization!
  ability = build_ability

  after(:all) do
    Spree::Ability.remove_ability(ability)
  end

  before(:all) do
    Spree::Ability.register_ability(ability)
  end

  before do
    allow(Spree.user_class).to receive(:find_by).
                                 with(hash_including(:spree_api_key)).
                                 and_return(Spree.user_class.new)
  end
end