Module: Temporal::Testing::WorkflowOverride

Included in:
Workflow
Defined in:
lib/temporal/testing/workflow_override.rb

Instance Method Summary collapse

Instance Method Details

#allow_all_releasesObject



14
15
16
# File 'lib/temporal/testing/workflow_override.rb', line 14

def allow_all_releases
  disabled_releases.clear
end

#allow_release(release_name) ⇒ Object



18
19
20
# File 'lib/temporal/testing/workflow_override.rb', line 18

def allow_release(release_name)
  disabled_releases.delete(release_name.to_s)
end

#disable_release(release_name) ⇒ Object



22
23
24
# File 'lib/temporal/testing/workflow_override.rb', line 22

def disable_release(release_name)
  disabled_releases << release_name.to_s
end

#disabled_releasesObject



10
11
12
# File 'lib/temporal/testing/workflow_override.rb', line 10

def disabled_releases
  @disabled_releases ||= Set.new
end

#execute_locally(*input) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/temporal/testing/workflow_override.rb', line 26

def execute_locally(*input)
  workflow_id = SecureRandom.uuid
  run_id = SecureRandom.uuid
  execution = WorkflowExecution.new
   = Temporal::Metadata::Workflow.new(
    name: workflow_id, run_id: run_id, attempt: 1
  )
  context = Temporal::Testing::LocalWorkflowContext.new(
    execution, workflow_id, run_id, disabled_releases, 
  )

  execute_in_context(context, input)
end