Class: Spectus::Sandbox Private
- Inherits:
-
Object
- Object
- Spectus::Sandbox
- Defined in:
- lib/spectus/sandbox.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.
This class evaluate the expectation with the passed block.
Instance Attribute Summary collapse
-
#actual ⇒ #object_id
readonly
private
The value that the subject return through its challenge.
-
#exception ⇒ #exception?
readonly
private
Any possible raised exception.
-
#got ⇒ #object_id
readonly
private
The result of the boolean comparison between the actual value and the expected value.
-
#last_challenge ⇒ Defi::Challenge
readonly
private
The last evaluated challenge.
Instance Method Summary collapse
-
#initialize(matcher, negate, object, *challenges) ⇒ Sandbox
constructor
private
Execute the untested code from the passed block against the matcher.
-
#valid? ⇒ Boolean
private
Report to the spec’s requirement level if the test is true or false.
Constructor Details
#initialize(matcher, negate, object, *challenges) ⇒ Sandbox
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.
Execute the untested code from the passed block against the matcher.
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/spectus/sandbox.rb', line 17 def initialize(matcher, negate, object, *challenges) @got = negate ^ matcher.matches? do @actual = challenges.inject(object) do |subject, challenge| @last_challenge = challenge @last_challenge.to(subject) end end rescue => e @exception = e end |
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.
39 40 41 |
# File 'lib/spectus/sandbox.rb', line 39 def actual @actual end |
#exception ⇒ #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.
44 45 46 |
# File 'lib/spectus/sandbox.rb', line 44 def exception @exception 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.
50 51 52 |
# File 'lib/spectus/sandbox.rb', line 50 def got @got end |
#last_challenge ⇒ Defi::Challenge (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 last evaluated challenge.
33 34 35 |
# File 'lib/spectus/sandbox.rb', line 33 def last_challenge @last_challenge end |
Instance Method Details
#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.
Report to the spec’s requirement level if the test is true or false.
55 56 57 58 59 |
# File 'lib/spectus/sandbox.rb', line 55 def valid? return false if defined?(@exception) got end |