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
- #exception ⇒ Object readonly private
- #got ⇒ Object readonly private
Instance Method Summary collapse
-
#initialize(definition, &actual) ⇒ Sandbox
constructor
private
Execute the untested code from the passed block against the definition.
-
#pass?(negate) ⇒ Boolean
private
Return the result as a positive or a negative assertion.
Constructor Details
#initialize(definition, &actual) ⇒ 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.
14 15 16 17 18 |
# File 'lib/spectus/sandbox.rb', line 14 def initialize(definition, &actual) @got = ::Expect.this(&actual).to(definition) rescue => e @exception = e end |
Instance Attribute Details
#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
#pass?(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.
Return the result as a positive or a negative assertion.
25 26 27 28 29 30 31 |
# File 'lib/spectus/sandbox.rb', line 25 def pass?(negate) if defined?(@exception) false else negate ^ @got end end |