Cucumberex.StepDefinition (cucumberex v0.2.1)

Copy Markdown View Source

A registered step definition with pattern and implementation.

Summary

Functions

Build a StepDefinition. A fresh UUID is assigned to :id on each call.

Types

t()

@type t() :: %Cucumberex.StepDefinition{
  compiled_regex: Regex.t() | nil,
  fun: function(),
  id: String.t(),
  keyword: :given | :when_ | :then | :step,
  location: String.t(),
  pattern: String.t() | Regex.t()
}

Functions

new(pattern, fun, location, keyword \\ :step)

Build a StepDefinition. A fresh UUID is assigned to :id on each call.

Examples

iex> sd = Cucumberex.StepDefinition.new("I have {int} cukes", fn _, _ -> :ok end, "t.ex:1", :given)
iex> {sd.pattern, sd.keyword, sd.location}
{"I have {int} cukes", :given, "t.ex:1"}

iex> sd = Cucumberex.StepDefinition.new(~r/^x$/, fn _, _ -> :ok end, "t.ex:1")
iex> sd.keyword
:step