Cucumber.StepRegistry.Definition (Cucumber v1.1.0)

Copy Markdown View Source

One step definition in a Cucumber.StepRegistry.

  • :position - the definition's index in file-and-line order
  • :kind - :expression (cucumber expression) or :regex
  • :source - the expression text, or the regex source
  • :module / :function - the step function, called with the context
  • :file / :line - where the definition is written

The :matcher field is internal.

Summary

Functions

Renders the pattern as written: an expression verbatim, a regex as a sigil with its flags.

Types

t()

@type t() :: %Cucumber.StepRegistry.Definition{
  file: String.t(),
  function: atom(),
  kind: :expression | :regex,
  line: pos_integer(),
  matcher: term(),
  module: module(),
  position: non_neg_integer(),
  source: String.t()
}

Functions

display_pattern(definition)

@spec display_pattern(t()) :: String.t()

Renders the pattern as written: an expression verbatim, a regex as a sigil with its flags.

Examples

Cucumber.StepRegistry.Definition.display_pattern(definition)
# => "I have {int} cukes" or "~r/^I have (\d+) cukes$/i"