lib/convenient_service/factories/services.rb in convenient_service-0.10.1 vs lib/convenient_service/factories/services.rb in convenient_service-0.11.0
- old
+ new
@@ -20,10 +20,20 @@
#
def create_service_with_success_result
::Class.new do
include ::ConvenientService::Configs::Standard
+ ##
+ # IMPORTANT:
+ # - `CanHaveMethodSteps` is disabled in the Standard config since it causes race conditions in combination with `CanHaveStubbedResult`.
+ # - It will be reenabled after the introduction of thread-safety specs.
+ # - Do not use it in production yet.
+ #
+ middlewares :step, scope: :class do
+ use ConvenientService::Plugins::Service::CanHaveMethodSteps::Middleware
+ end
+
def result
success
end
end
end
@@ -58,10 +68,20 @@
#
def create_service_with_failure_result
::Class.new do
include ::ConvenientService::Configs::Standard
+ ##
+ # IMPORTANT:
+ # - `CanHaveMethodSteps` is disabled in the Standard config since it causes race conditions in combination with `CanHaveStubbedResult`.
+ # - It will be reenabled after the introduction of thread-safety specs.
+ # - Do not use it in production yet.
+ #
+ middlewares :step, scope: :class do
+ use ConvenientService::Plugins::Service::CanHaveMethodSteps::Middleware
+ end
+
def result
failure(data)
end
private
@@ -86,10 +106,20 @@
#
def create_service_with_error_result
::Class.new do
include ::ConvenientService::Configs::Standard
+ ##
+ # IMPORTANT:
+ # - `CanHaveMethodSteps` is disabled in the Standard config since it causes race conditions in combination with `CanHaveStubbedResult`.
+ # - It will be reenabled after the introduction of thread-safety specs.
+ # - Do not use it in production yet.
+ #
+ middlewares :step, scope: :class do
+ use ConvenientService::Plugins::Service::CanHaveMethodSteps::Middleware
+ end
+
def result
error(message)
end
private
@@ -162,9 +192,19 @@
#
def create_service_class(steps: [])
::Class.new.tap do |klass|
klass.class_exec(steps: steps) do
include ::ConvenientService::Configs::Standard
+
+ ##
+ # IMPORTANT:
+ # - `CanHaveMethodSteps` is disabled in the Standard config since it causes race conditions in combination with `CanHaveStubbedResult`.
+ # - It will be reenabled after the introduction of thread-safety specs.
+ # - Do not use it in production yet.
+ #
+ middlewares :step, scope: :class do
+ use ConvenientService::Plugins::Service::CanHaveMethodSteps::Middleware
+ end
steps.each do |step_name|
case step_name
when ::Class
step step_name