Class: Fix::On Private

Inherits:
Object
  • Object
show all
Defined in:
lib/fix/its.rb

Overview

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

Open the on class.

Instance Method Summary collapse

Instance Method Details

#its(method, &spec) ⇒ Array

Add its method to the DSL.

rubocop:disable AbcSize

Examples:

Its absolute value must equal 42

its(:abs) { MUST equal 42 }

Parameters:

  • method (Symbol)

    The identifier of a method.

  • spec (Proc)

    A spec to compare against the computed value.

Returns:

  • (Array)

    List of results.



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/fix/its.rb', line 28

def its(method, &spec)
  i = It.new(described, (challenges + [Defi.send(method)]), helpers.dup)

  result = i.verify(&spec)

  if configuration.fetch(:verbose, true)
    print result.to_char(configuration.fetch(:color, false))
  end

  results << result
end