Files
openfoodnetwork/lib/spree/api/controller_setup.rb
Matt-Yorkley 83f58368c7 Fix class-loading issue in test suite
Fixes:

```
Failure/Error: include Spree::Core::ControllerHelpers::Auth

NameError:
  uninitialized constant Spree::Core::ControllerHelpers::Auth
# ./lib/spree/api/controller_setup.rb:19:in `block in included'
# ./lib/spree/api/controller_setup.rb:5:in `class_eval'
# ./lib/spree/api/controller_setup.rb:5:in `included'
# ./app/controllers/api/base_controller.rb:9:in `include'
# ./app/controllers/api/base_controller.rb:9:in `<class:BaseController>'
# ./app/controllers/api/base_controller.rb:6:in `<module:Api>'
# ./app/controllers/api/base_controller.rb:5:in `<top (required)>'
# ./app/controllers/api/products_controller.rb:5:in `<module:Api>'
# ./app/controllers/api/products_controller.rb:4:in `<top (required)>'
# ./spec/controllers/api/products_controller_spec.rb:6:in `<top (required)>'
```
2021-01-09 13:26:30 +00:00

30 lines
852 B
Ruby

require 'spree/core/controller_helpers/auth'
module Spree
module Api
module ControllerSetup
def self.included(klass)
klass.class_eval do
include AbstractController::Rendering
include ActionView::ViewPaths
include AbstractController::Callbacks
include AbstractController::Helpers
include ActiveSupport::Rescuable
include ActionController::Rendering
include ActionController::ImplicitRender
include ActionController::Rescue
include ActionController::Head
include CanCan::ControllerAdditions
include Spree::Core::ControllerHelpers::Auth
prepend_view_path Rails.root + "app/views"
append_view_path File.expand_path("../../../app/views", File.dirname(__FILE__))
end
end
end
end
end