Remove dependency to Spree::ApiConfiguration, overall requires_authentication? is true, exceptions will be endpoint specific

This commit is contained in:
luisramos0
2019-07-19 23:12:19 +01:00
parent 314ed50e0f
commit 18aa16650d
3 changed files with 2 additions and 5 deletions

View File

@@ -57,7 +57,7 @@ module Spree
def check_for_user_or_api_key
# User is already authenticated with Spree, make request this way instead.
return true if @current_api_user = try_spree_current_user ||
!Spree::Api::Config[:requires_authentication]
!requires_authentication?
return if api_key.present?
render("spree/api/errors/must_specify_api_key", status: :unauthorized) && return
@@ -86,7 +86,7 @@ module Spree
end
def requires_authentication?
Spree::Api::Config[:requires_authentication]
true
end
def not_found

View File

@@ -14,7 +14,6 @@ describe Spree::Api::BaseController do
before do
allow(controller).to receive_messages try_spree_current_user:
double(email: "spree@example.com")
Spree::Api::Config[:requires_authentication] = true
end
it "can make a request" do

View File

@@ -127,8 +127,6 @@ RSpec.configure do |config|
spree_config.shipping_instructions = true
spree_config.auto_capture = true
end
Spree::Api::Config[:requires_authentication] = true
end
# Helpers