Module: Fix::Its Private

Included in:
On
Defined in:
lib/fix/its.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.

Its’s helper.

Instance Method Summary collapse

Instance Method Details

#its(method_name, &spec) ⇒ Array

Add its method to the DSL.

Examples:

Its absolute value must equal 42

its(:abs) { MUST Equal: 42 }

Parameters:

  • method_name (Symbol)

    The identifier of a method.

  • spec (Proc)

    A spec to compare against the computed value.

Returns:

  • (Array)

    List of results.



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/fix/its.rb', line 24

def its(method_name, &spec)
  i = It.new(@front_object, *@challenges, Defi.send(method_name))

  result = begin
             i.instance_eval(&spec)
           rescue Spectus::Result::Fail => f
             f
           end

  print result.to_char if @configuration.fetch(:verbose, true)
  results << result
end