Method: Fix::On#its

Defined in:
lib/fix/its.rb

#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