From 3b1ad29d20dfa482c75e4f2740a37a29ae7cc006 Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Wed, 6 Jan 2021 12:26:47 +0000 Subject: [PATCH] Fix view rendering in Api::BaseController --- app/controllers/api/base_controller.rb | 3 +++ spec/controllers/api/order_cycles_controller_spec.rb | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/controllers/api/base_controller.rb b/app/controllers/api/base_controller.rb index b75c92e22e..54feee3802 100644 --- a/app/controllers/api/base_controller.rb +++ b/app/controllers/api/base_controller.rb @@ -10,6 +10,9 @@ module Api include Spree::Core::ControllerHelpers::SSL include ::ActionController::Head include ::ActionController::ConditionalGet + include ActionView::Layouts + + layout false attr_accessor :current_api_user diff --git a/spec/controllers/api/order_cycles_controller_spec.rb b/spec/controllers/api/order_cycles_controller_spec.rb index c16a3294d2..3301a16818 100644 --- a/spec/controllers/api/order_cycles_controller_spec.rb +++ b/spec/controllers/api/order_cycles_controller_spec.rb @@ -154,7 +154,8 @@ module Api allow_any_instance_of(OrderCycle).to receive(:open?) { false } end - xit "throws an error, ActionView::MissingTemplate: Missing template api/order_cycles/products" do + # Regression test for https://github.com/openfoodfoundation/openfoodnetwork/issues/6491 + it "renders no products without error" do api_get :products, id: order_cycle.id, distributor: distributor.id expect(json_response).to eq({})