Module: Oselvar::Var::Core::StepRole

Defined in:
lib/oselvar/var/core/step_role.rb

Overview

The role a step definition plays:

"stimulus" — drives the software (arranges and acts on state)
"sensor"   — the read-only assertion (the only role that returns for
           comparison)

Purely structural — never inspects sentence words (no Given/When/Then heuristics). Port of step-role.ts.

Class Method Summary collapse

Class Method Details

.infer_step_role(neighbours) ⇒ Object

Guess a step's role from its document-order neighbours. A step with nothing after it is most likely the observation; anything followed by other steps is most likely driving the software.



18
19
20
21
# File 'lib/oselvar/var/core/step_role.rb', line 18

def infer_step_role(neighbours)
  after = neighbours[:after] || neighbours['after'] || []
  after.empty? ? 'sensor' : 'stimulus'
end