Sha256: 10f2eabc72b49d2eb1b506856bfc35e787b834cf1fec2ac5fc0be2fbd9398492

Contents?: true

Size: 1.2 KB

Versions: 1

Compression:

Stored size: 1.2 KB

Contents

# frozen_string_literal: true

##
# WIP: Factory API is NOT well-thought yet. It will be revisited and completely refactored at any time.
#
module ConvenientService
  module Factories
    module Step
      module Instance
        ##
        # @return [ConvenientService::Service::Plugins::CanHaveSteps::Entities::Step]
        #
        def create_step_instance
          service_class =
            ::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

              step :result

              def result
                success
              end
            end

          service_instance = service_class.new

          service_instance.steps.first
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
convenient_service-0.11.0 lib/convenient_service/factories/step/instance.rb