A registered hook with phase, tag filter, and implementation.
Summary
Functions
Check if a hook should apply to a scenario tagged with the given tags. A hook with no tag expression applies to all scenarios.
Build a Hook. A fresh UUID is assigned to :id on each call.
Types
Functions
Check if a hook should apply to a scenario tagged with the given tags. A hook with no tag expression applies to all scenarios.
Examples
iex> h = %Cucumberex.Hook{tag_expression: nil}
iex> Cucumberex.Hook.applies_to?(h, ["@any"])
true
iex> h = %Cucumberex.Hook{tag_expression: "@smoke"}
iex> Cucumberex.Hook.applies_to?(h, ["@smoke"])
true
iex> h = %Cucumberex.Hook{tag_expression: "@smoke"}
iex> Cucumberex.Hook.applies_to?(h, ["@other"])
false
Build a Hook. A fresh UUID is assigned to :id on each call.
Examples
iex> h = Cucumberex.Hook.new(:before, fn _ -> :ok end, tags: "@smoke")
iex> {h.phase, h.tag_expression, h.order, h.location}
{:before, "@smoke", 0, "unknown"}
iex> h = Cucumberex.Hook.new(:after, fn _ -> :ok end)
iex> h.tag_expression
nil