lib/convenient_service/service/configs/standard.rb in convenient_service-0.18.0 vs lib/convenient_service/service/configs/standard.rb in convenient_service-0.19.0
- old
+ new
@@ -20,11 +20,11 @@
# That is why `class self::Result` is used.
# - https://stackoverflow.com/a/51965126/12201472
#
# rubocop:disable Lint/ConstantDefinitionInBlock
included do
- include Configs::Minimal
+ include Configs::Essential
concerns do
use ConvenientService::Plugins::Common::CachesConstructorArguments::Concern
use ConvenientService::Plugins::Common::CanBeCopied::Concern
use ConvenientService::Plugins::Service::CanRecalculateResult::Concern
@@ -41,13 +41,11 @@
use ConvenientService::Plugins::Service::CollectsServicesInException::Middleware
use ConvenientService::Plugins::Common::CachesConstructorArguments::Middleware
end
middlewares :result do
- insert_after \
- ConvenientService::Plugins::Common::NormalizesEnv::Middleware,
- ConvenientService::Plugins::Service::CollectsServicesInException::Middleware
+ unshift ConvenientService::Plugins::Service::CollectsServicesInException::Middleware
insert_before \
ConvenientService::Plugins::Service::RaisesOnNotResultReturnValue::Middleware,
ConvenientService::Plugins::Common::HasCallbacks::Middleware
@@ -63,42 +61,35 @@
insert_before \
ConvenientService::Plugins::Service::RaisesOnNotResultReturnValue::Middleware,
ConvenientService::Plugins::Service::SetsParentToForeignResult::Middleware
end
- ##
- # @internal
- # NOTE: Check `Minimal` docs to understand why `use ConvenientService::Plugins::Common::NormalizesEnv::Middleware` for `:fallback_failure_result` is used in `Standard`, not in `Minimal` config.
- #
middlewares :fallback_failure_result do
- use ConvenientService::Plugins::Common::NormalizesEnv::Middleware
use ConvenientService::Plugins::Service::CollectsServicesInException::Middleware
use ConvenientService::Plugins::Common::CachesReturnValue::Middleware
use ConvenientService::Plugins::Service::RaisesOnNotResultReturnValue::Middleware
use ConvenientService::Plugins::Service::CanHaveFallbacks::Middleware.with(status: :failure)
end
- ##
- # @internal
- # NOTE: Check `Minimal` docs to understand why `use ConvenientService::Plugins::Common::NormalizesEnv::Middleware` for `:fallback_error_result` is used in `Standard`, not in `Minimal` config.
- #
middlewares :fallback_error_result do
- use ConvenientService::Plugins::Common::NormalizesEnv::Middleware
use ConvenientService::Plugins::Service::CollectsServicesInException::Middleware
use ConvenientService::Plugins::Common::CachesReturnValue::Middleware
use ConvenientService::Plugins::Service::RaisesOnNotResultReturnValue::Middleware
use ConvenientService::Plugins::Service::CanHaveFallbacks::Middleware.with(status: :error)
end
- ##
- # @internal
- # NOTE: Check `Minimal` docs to understand why `use ConvenientService::Plugins::Common::NormalizesEnv::Middleware` for `:negated_result` is used in `Standard`, not in `Minimal` config.
- #
+ middlewares :fallback_result do
+ use ConvenientService::Plugins::Service::CollectsServicesInException::Middleware
+ use ConvenientService::Plugins::Common::CachesReturnValue::Middleware
+
+ use ConvenientService::Plugins::Service::RaisesOnNotResultReturnValue::Middleware
+ use ConvenientService::Plugins::Service::CanHaveFallbacks::Middleware.with(status: nil)
+ end
+
middlewares :negated_result do
- use ConvenientService::Plugins::Common::NormalizesEnv::Middleware
use ConvenientService::Plugins::Service::CollectsServicesInException::Middleware
use ConvenientService::Plugins::Common::CachesReturnValue::Middleware
use ConvenientService::Plugins::Common::EnsuresNegatedJSendResult::Middleware
end
@@ -106,11 +97,11 @@
##
# TODO:
# `after :step do |step|` is executed after step result is calculated.
# This completely makes sence and is useful for debugging for example.
#
- # But `before :step do` is alos executed after step result is calculated.
+ # But `before :step do` is also executed after step result is calculated.
# That confuses the end-users a lot.
# Probably a dedicated plugin is needed?
# Or to forbid `before :step do`?
#
middlewares :step do
@@ -134,10 +125,11 @@
concerns do
use ConvenientService::Plugins::Common::HasJSendResultDuckShortSyntax::Concern
use ConvenientService::Plugins::Result::CanRecalculateResult::Concern
use ConvenientService::Plugins::Result::HasNegatedResult::Concern
+ use ConvenientService::Plugins::Result::CanBeFromException::Concern
use ConvenientService::Plugins::Result::CanBeOwnResult::Concern
use ConvenientService::Plugins::Result::CanHaveFallbacks::Concern
use ConvenientService::Plugins::Result::CanHaveParentResult::Concern
use ConvenientService::Plugins::Result::CanHaveCheckedStatus::Concern
end
@@ -153,12 +145,10 @@
middlewares :code do
use ConvenientService::Plugins::Result::RaisesOnNotCheckedResultStatus::Middleware
end
middlewares :negated_result do
- use ConvenientService::Plugins::Common::NormalizesEnv::Middleware
-
use ConvenientService::Plugins::Common::EnsuresNegatedJSendResult::Middleware
end
class self::Status
concerns do
@@ -196,36 +186,34 @@
use ConvenientService::Plugins::Common::HasJSendResultDuckShortSyntax::Concern
use ConvenientService::Plugins::Step::CanHaveFallbacks::Concern
end
middlewares :result do
- use ConvenientService::Plugins::Step::CanHaveFallbacks::Middleware.with(fallback_true_status: :failure)
-
insert_after \
ConvenientService::Plugins::Step::HasResult::Middleware,
ConvenientService::Plugins::Step::CanHaveParentResult::Middleware
+
+ insert_after \
+ ConvenientService::Plugins::Step::HasResult::Middleware,
+ ConvenientService::Plugins::Step::CanHaveFallbacks::Middleware.with(fallback_true_status: :failure)
end
end
if Dependencies.rspec.loaded?
concerns do
- insert_before 0, ConvenientService::Plugins::Service::CanHaveStubbedResults::Concern
+ unshift ConvenientService::Plugins::Service::CanHaveStubbedResults::Concern
end
middlewares :result do
- insert_after \
- ConvenientService::Plugins::Common::NormalizesEnv::Middleware,
- ConvenientService::Plugins::Service::CanHaveStubbedResults::Middleware
+ unshift ConvenientService::Plugins::Service::CanHaveStubbedResults::Middleware
insert_before \
ConvenientService::Plugins::Service::CanHaveStubbedResults::Middleware,
ConvenientService::Plugins::Service::CountsStubbedResultsInvocations::Middleware
end
middlewares :result, scope: :class do
- insert_after \
- ConvenientService::Plugins::Common::NormalizesEnv::Middleware,
- ConvenientService::Plugins::Service::CanHaveStubbedResults::Middleware
+ unshift ConvenientService::Plugins::Service::CanHaveStubbedResults::Middleware
insert_before \
ConvenientService::Plugins::Service::CanHaveStubbedResults::Middleware,
ConvenientService::Plugins::Service::CountsStubbedResultsInvocations::Middleware
end