Module: Fix::OnHelper Private

Defined in:
lib/fix/helpers/on_helper.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

On’s helper.

Instance Method Summary collapse

Instance Method Details

#let(method_name, &block) ⇒ BasicObject

Returns List of results.

Examples:

Let’s define the answer to the Ultimate Question of Life, the

Universe, and Everything.

let(:answer) { 42 }

Parameters:

  • method_name (Symbol)

    The identifier of a method.

  • block (Proc)

    A spec to compare against the computed value.

Returns:

  • (BasicObject)

    List of results.



42
43
44
# File 'lib/fix/helpers/on_helper.rb', line 42

def let(method_name, &block)
  @helpers.update(method_name => block)
end

#on(method_name, *args, &block) ⇒ Array

Add on method to the DSL.

Examples:

On +2, it must equal 44.

on(:+, 2) do
  it { MUST Equal: 44 }
end

Parameters:

  • method_name (Symbol)

    The identifier of a method.

  • args (Array)

    A list of arguments.

  • block (Proc)

    A spec to compare against the computed value.

Returns:

  • (Array)

    List of results.



21
22
23
24
25
26
27
28
29
# File 'lib/fix/helpers/on_helper.rb', line 21

def on(method_name, *args, &block)
  o = On.new(@front_object,
             results,
             (@challenges + [Defi.send(method_name, *args)]),
             @helpers.dup,
             @configuration)

  o.instance_eval(&block)
end