Module: Riot::Gear::OnceContextHelper

Defined in:
lib/riot/gear/context/once.rb

Instance Method Summary collapse

Instance Method Details

#once(description = "", &definition) ⇒ Riot::Gear::OnceRunnable

A setup helper that will only run once and only in the context it was defined in. This will not be run in any of its sub-contexts and it will run before any assertions … the same as any other setup block.

once "doing this one thing" do
  topic.post "/user/things", :query => {"name" => "x"}
end

Parameters:

  • description (String) (defaults to: "")

    A description of what the block is for

  • &definition (lambda)

    The block that will be executed once

Returns:



36
37
38
# File 'lib/riot/gear/context/once.rb', line 36

def once(description="", &definition)
  @setups << Riot::Gear::OnceRunnable.new(description, &definition)
end