Class: SpecForge::Forge::Call

Inherits:
Action
  • Object
show all
Defined in:
lib/spec_forge/forge/actions/call.rb

Overview

Action for the call: step attribute

Executes registered callbacks defined in forge_helper.rb during step processing. Callbacks can receive the current context and optional arguments.

Instance Attribute Summary

Attributes inherited from Action

#step

Instance Method Summary collapse

Methods inherited from Action

#initialize

Constructor Details

This class inherits a constructor from SpecForge::Forge::Action

Instance Method Details

#run(forge) ⇒ void

This method returns an undefined value.

Executes all callbacks defined in the step's call: attribute

Parameters:

  • forge (Forge)

    The forge instance for accessing callbacks and display



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/spec_forge/forge/actions/call.rb', line 19

def run(forge)
  context = SpecForge::Forge.context

  step.calls.each do |call|
    callback_name = call.callback_name
    arguments = call.arguments

    forge.display.action("Call #{callback_name}", symbol: :checkmark, symbol_styles: :yellow)

    forge.callbacks.run(callback_name, context, arguments)
  end
end