class Temporal::Testing::WorkflowExecution

Attributes

fiber[R]
futures[R]
status[R]

Public Class Methods

new() click to toggle source
# File lib/temporal/testing/workflow_execution.rb, line 8
def initialize
  @status = Workflow::ExecutionInfo::RUNNING_STATUS
  @futures = FutureRegistry.new
end

Public Instance Methods

complete_activity(token, result) click to toggle source
# File lib/temporal/testing/workflow_execution.rb, line 29
def complete_activity(token, result)
  futures.complete(token, result)
  resume
end
fail_activity(token, exception) click to toggle source
# File lib/temporal/testing/workflow_execution.rb, line 34
def fail_activity(token, exception)
  futures.fail(token, exception)
  resume
end
register_future(token, future) click to toggle source
# File lib/temporal/testing/workflow_execution.rb, line 25
def register_future(token, future)
  futures.register(token, future)
end
resume() click to toggle source
# File lib/temporal/testing/workflow_execution.rb, line 18
def resume
  fiber.resume
  @status = Workflow::ExecutionInfo::COMPLETED_STATUS unless fiber.alive?
rescue StandardError
  @status = Workflow::ExecutionInfo::FAILED_STATUS
end
run(&block) click to toggle source
# File lib/temporal/testing/workflow_execution.rb, line 13
def run(&block)
  @fiber = Fiber.new(&block)
  resume
end