Module: Spectus::Result::Base Private

Included in:
Fail, Pass
Defined in:
lib/spectus/result/base.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.

Result base’s module.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#actual#object_id (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 value that the subject return through its challenge.



53
54
55
# File 'lib/spectus/result/base.rb', line 53

def actual
  @actual
end

#challengeSymbol (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 method to call on the subject.



47
48
49
# File 'lib/spectus/result/base.rb', line 47

def challenge
  @challenge
end

#error#exception? (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 Any possible raised exception.



69
70
71
# File 'lib/spectus/result/base.rb', line 69

def error
  @error
end

#expected#matches? (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 definition of the expected value.



58
59
60
# File 'lib/spectus/result/base.rb', line 58

def expected
  @expected
end

#got#object_id (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 result of the boolean comparison between the actual value and the expected value.



64
65
66
# File 'lib/spectus/result/base.rb', line 64

def got
  @got
end

#level:High, ... (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 level of the expectation.



74
75
76
# File 'lib/spectus/result/base.rb', line 74

def level
  @level
end

#subject#object_id (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 untrusted object to be tested.



42
43
44
# File 'lib/spectus/result/base.rb', line 42

def subject
  @subject
end

Instance Method Details

#initialize(message, subject, challenge, actual, expected, got, error, level, negate, valid) ⇒ Object

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.

Initialize the result class.



24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/spectus/result/base.rb', line 24

def initialize(message, subject, challenge, actual, expected, got, error,
  level, negate, valid)

  @message    = message.to_s
  @subject    = subject
  @challenge  = challenge
  @actual     = actual
  @expected   = expected
  @got        = got
  @error      = error
  @level      = level
  @negate     = negate
  @valid      = valid
end

#negate?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 negate instance variable.



79
80
81
# File 'lib/spectus/result/base.rb', line 79

def negate?
  @negate
end

#to_hHash

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.

Properties of the result.



94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/spectus/result/base.rb', line 94

def to_h
  {
    subject:    subject,
    challenge:  challenge.to_h,
    actual:     actual,
    expected:   expected.to_h,
    got:        got,
    error:      error,
    level:      level,
    negate:     negate?,
    valid:      valid?,
    result:     result?
  }
end

#valid?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 boolean comparison between the actual value and the expected value.



87
88
89
# File 'lib/spectus/result/base.rb', line 87

def valid?
  @valid
end