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

#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
# File 'lib/fix/helpers/on_helper.rb', line 21

def on(method_name, *args, &block)
  o = On.new(@front_object,
             results,
             (@challenges + [Spectus::Challenge.new(method_name, *args)]),
             @configuration)

  o.instance_eval(&block)
end