Step definition DSL.
Usage
defmodule MySteps do
use Cucumberex.DSL
given_ "I have {int} cukes in my belly", fn world, count ->
Map.put(world, :cukes, count)
end
when_ ~r/I eat (\d+) cukes/, fn world, count_str ->
count = String.to_integer(count_str)
Map.update(world, :cukes, 0, &(&1 - count))
end
then_ "I should have {int} cukes", fn world, expected ->
if world.cukes != expected do
raise "Expected #{expected} cukes, got #{world.cukes}"
end
world
end
endStep functions: fn world, arg1, arg2, ... -> new_world end
Call pending() inside to mark a step pending.
Summary
Functions
Execute step: fun is {module, fun_name} or an anonymous fn.
Load a step module into the registry.
Functions
Execute step: fun is {module, fun_name} or an anonymous fn.
Load a step module into the registry.