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 readonly private
- #exception ⇒ Object readonly private
- #got ⇒ Object readonly private
Instance Method Summary collapse
-
#initialize(definition, negate, object, meth, *args) ⇒ Sandbox
constructor
private
Execute the untested code from the passed block against the definition.
-
#valid? ⇒ Boolean
private
Report to the spec’s requirement level if the test is true or false.
Constructor Details
#initialize(definition, negate, object, meth, *args) ⇒ 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 definition.
18 19 20 21 22 23 24 |
# File 'lib/spectus/sandbox.rb', line 18 def initialize(definition, negate, object, meth, *args) @got = negate ^ matcher(definition).matches? do @actual = object.public_send(meth, *args) end rescue => e @exception = e end |
Instance Attribute Details
#actual ⇒ Object (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.
9 10 11 |
# File 'lib/spectus/sandbox.rb', line 9 def actual @actual end |
#exception ⇒ Object (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.
9 10 11 |
# File 'lib/spectus/sandbox.rb', line 9 def exception @exception end |
#got ⇒ Object (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.
9 10 11 |
# File 'lib/spectus/sandbox.rb', line 9 def got @got 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.
29 30 31 32 33 34 35 |
# File 'lib/spectus/sandbox.rb', line 29 def valid? if defined?(@exception) false else @got end end |