From cfbec2accc67012116e52301379468d5603918cc Mon Sep 17 00:00:00 2001 From: Luis Ramos Date: Thu, 5 Mar 2020 11:55:13 +0000 Subject: [PATCH] Fix controller specs after PR #4675 adapted code to rails 4 finders --- spec/controllers/admin/enterprises_controller_spec.rb | 4 ++-- spec/controllers/api/enterprises_controller_spec.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/controllers/admin/enterprises_controller_spec.rb b/spec/controllers/admin/enterprises_controller_spec.rb index a8c2802e47..a95334d292 100644 --- a/spec/controllers/admin/enterprises_controller_spec.rb +++ b/spec/controllers/admin/enterprises_controller_spec.rb @@ -449,8 +449,8 @@ module Admin before do # As a user with permission allow(controller).to receive_messages spree_current_user: user - allow(OrderCycle).to receive_messages find_by_id: "existing OrderCycle" - allow(Enterprise).to receive_messages find_by_id: "existing Enterprise" + allow(OrderCycle).to receive_messages find_by: "existing OrderCycle" + allow(Enterprise).to receive_messages find_by: "existing Enterprise" allow(OrderCycle).to receive_messages new: "new OrderCycle" allow(OpenFoodNetwork::OrderCyclePermissions).to receive(:new) { permission_mock } diff --git a/spec/controllers/api/enterprises_controller_spec.rb b/spec/controllers/api/enterprises_controller_spec.rb index 364a7fd146..05a26ec143 100644 --- a/spec/controllers/api/enterprises_controller_spec.rb +++ b/spec/controllers/api/enterprises_controller_spec.rb @@ -52,7 +52,7 @@ module Api describe "submitting a valid image" do before do allow(Enterprise) - .to receive(:find_by_permalink).with(enterprise.id.to_s) { enterprise } + .to receive(:find_by).with({ permalink: enterprise.id.to_s }) { enterprise } allow(enterprise).to receive(:update_attributes).and_return(true) end @@ -68,7 +68,7 @@ module Api before do allow(Enterprise) - .to receive(:find_by_permalink).with(enterprise.id.to_s) { enterprise } + .to receive(:find_by).with({ permalink: enterprise.id.to_s }) { enterprise } allow(controller).to receive(:spree_current_user) { non_managing_user } end