Used to decorate a helper. A helper generally ends up being a glorified method that can be referenced from within a setup, teardown, hookup, other helpers, assertion blocks, and assertion macro blocks; basically anywhere the {Riot::Situation} instance is available.
context "Making dinner" do helper(:easy_bake) do |thing| EasyBake.new(thing, :ingredients => [:ketchup, :chocolate, :syrup]) end setup do easy_bake(:meatloaf) end asserts(:food_poisoning_probabilty).equals(0.947) end # Making dinner
# File lib/riot/runnable.rb, line 70 def initialize(name, &definition) super("helper #{name}", &definition) @name = name end
Calls {Riot::Situation#helper} with the predefined helper name and block at
{Riot::Context} run-time. Though this is like every other kind of
{Riot::RunnableBlock}, run
will not return a meaningful
state, which means the reporter will likely not report anything.
@param [Riot::Situation] situation the situation for the current {Riot::Context} run @return [Array<Symbol>] array containing the evaluation state
# File lib/riot/runnable.rb, line 81 def run(situation) situation.helper(@name, &definition) [:helper] end