Class: Spectus::Result::Pass Private

Inherits:
Object
  • Object
show all
Includes:
Base
Defined in:
lib/spectus/result/pass.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.

The class that is responsible for reporting that the expectation is true.

Instance Attribute Summary collapse

Attributes included from Base

#actual, #challenge, #error, #expected, #got, #level, #subject

Instance Method Summary collapse

Methods included from Base

#initialize, #negate?, #to_h, #valid?

Instance Attribute Details

#messageString (readonly)

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

Returns The message that describe the state.

Returns:

  • (String)

    The message that describe the state.



14
15
16
# File 'lib/spectus/result/pass.rb', line 14

def message
  @message
end

Instance Method Details

#info?Boolean

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

The state of info.

Returns:

  • (Boolean)

    The test was an info.



33
34
35
# File 'lib/spectus/result/pass.rb', line 33

def info?
  !success?
end

#result?Boolean

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

The value of the expectation of the spec.

Returns:

  • (Boolean)

    The spec was true.



19
20
21
# File 'lib/spectus/result/pass.rb', line 19

def result?
  true
end

#success?Boolean

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

The state of success.

Returns:

  • (Boolean)

    The test was a success.



26
27
28
# File 'lib/spectus/result/pass.rb', line 26

def success?
  got.equal?(true)
end

#to_char(color = false) ⇒ String

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

Express the result with one char.

Parameters:

  • color (Boolean) (defaults to: false)

    Enable the color.

Returns:

  • (String)

    The char that identify the result.



49
50
51
52
53
54
55
# File 'lib/spectus/result/pass.rb', line 49

def to_char(color = false)
  if success?
    color ? "\e[32m.\e[0m" : '.'
  else
    color ? "\e[33mI\e[0m" : 'I'
  end
end

#to_symSymbol

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

Identify the state of the result.

Returns:

  • (Symbol)

    The identifier of the state.



40
41
42
# File 'lib/spectus/result/pass.rb', line 40

def to_sym
  success? ? :success : :info
end