From 148317df2d9973692ff2d60b404021c72c3c8cab Mon Sep 17 00:00:00 2001 From: Marian13 Date: Tue, 4 Jun 2024 00:40:16 +0300 Subject: [PATCH] fix(can_have_fallbacks): use ConvenientService.raise --- .../plugins/can_have_fallbacks/middleware.rb | 2 +- .../can_have_fallbacks/middleware_spec.rb | 25 +++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_have_fallbacks/middleware.rb b/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_have_fallbacks/middleware.rb index 370952dbcfa..385b8defb04 100644 --- a/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_have_fallbacks/middleware.rb +++ b/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_have_fallbacks/middleware.rb @@ -130,7 +130,7 @@ def service def refute_method_step! return unless step.method_step? - raise Exceptions::MethodStepCanNotHaveFallback.new(step: step) + ::ConvenientService.raise Exceptions::MethodStepCanNotHaveFallback.new(step: step) end end end diff --git a/spec/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_have_fallbacks/middleware_spec.rb b/spec/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_have_fallbacks/middleware_spec.rb index f41e91a2e41..a80d4cc88e1 100644 --- a/spec/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_have_fallbacks/middleware_spec.rb +++ b/spec/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_have_fallbacks/middleware_spec.rb @@ -299,6 +299,11 @@ def foo .to raise_error(ConvenientService::Service::Plugins::CanHaveSteps::Entities::Step::Plugins::CanHaveFallbacks::Exceptions::MethodStepCanNotHaveFallback) .with_message(exception_message) end + + specify do + expect { ignoring_exception(ConvenientService::Service::Plugins::CanHaveSteps::Entities::Step::Plugins::CanHaveFallbacks::Exceptions::MethodStepCanNotHaveFallback) { method_value } } + .to delegate_to(ConvenientService, :raise) + end end end @@ -512,6 +517,11 @@ def foo .to raise_error(ConvenientService::Service::Plugins::CanHaveSteps::Entities::Step::Plugins::CanHaveFallbacks::Exceptions::MethodStepCanNotHaveFallback) .with_message(exception_message) end + + specify do + expect { ignoring_exception(ConvenientService::Service::Plugins::CanHaveSteps::Entities::Step::Plugins::CanHaveFallbacks::Exceptions::MethodStepCanNotHaveFallback) { method_value } } + .to delegate_to(ConvenientService, :raise) + end end end @@ -753,6 +763,11 @@ def foo .to raise_error(ConvenientService::Service::Plugins::CanHaveSteps::Entities::Step::Plugins::CanHaveFallbacks::Exceptions::MethodStepCanNotHaveFallback) .with_message(exception_message) end + + specify do + expect { ignoring_exception(ConvenientService::Service::Plugins::CanHaveSteps::Entities::Step::Plugins::CanHaveFallbacks::Exceptions::MethodStepCanNotHaveFallback) { method_value } } + .to delegate_to(ConvenientService, :raise) + end end end @@ -943,6 +958,11 @@ def foo .to raise_error(ConvenientService::Service::Plugins::CanHaveSteps::Entities::Step::Plugins::CanHaveFallbacks::Exceptions::MethodStepCanNotHaveFallback) .with_message(exception_message) end + + specify do + expect { ignoring_exception(ConvenientService::Service::Plugins::CanHaveSteps::Entities::Step::Plugins::CanHaveFallbacks::Exceptions::MethodStepCanNotHaveFallback) { method_value } } + .to delegate_to(ConvenientService, :raise) + end end end @@ -1178,6 +1198,11 @@ def foo .to raise_error(ConvenientService::Service::Plugins::CanHaveSteps::Entities::Step::Plugins::CanHaveFallbacks::Exceptions::MethodStepCanNotHaveFallback) .with_message(exception_message) end + + specify do + expect { ignoring_exception(ConvenientService::Service::Plugins::CanHaveSteps::Entities::Step::Plugins::CanHaveFallbacks::Exceptions::MethodStepCanNotHaveFallback) { method_value } } + .to delegate_to(ConvenientService, :raise) + end end end