Exception: Assay::ExecutionFailure
- Defined in:
- lib/assay/assertions/execution_failure.rb
Overview
Assert that a block of coded executes without error.
ExecutionFailure is also the base class of the other block-executing assertion classes.
Direct Known Subclasses
Constant Summary
Constants inherited from Assertion
Class Method Summary collapse
- .assertion_name ⇒ Object
-
.fail?(_ = nil, &block) ⇒ Boolean
Check negated assertion.
-
.pass?(_ = nil, &block) ⇒ Boolean
Check assertion.
Instance Method Summary collapse
Methods inherited from Assertion
assert, #assert, assertable_method, #assertion?, #fail?, #initialize, #negative?, #pass?, refute, #refute, #set_arguments, #set_negative, to_matcher
Constructor Details
This class inherits a constructor from Assay::Assertion
Class Method Details
.assertion_name ⇒ Object
11 12 13 |
# File 'lib/assay/assertions/execution_failure.rb', line 11 def self.assertion_name :execution end |
.fail?(_ = nil, &block) ⇒ Boolean
Check negated assertion.
26 27 28 29 30 31 32 33 |
# File 'lib/assay/assertions/execution_failure.rb', line 26 def self.fail?(_=nil, &block) begin block.call false rescue Exception true end end |
.pass?(_ = nil, &block) ⇒ Boolean
Check assertion.
16 17 18 19 20 21 22 23 |
# File 'lib/assay/assertions/execution_failure.rb', line 16 def self.pass?(_=nil, &block) begin block.call true rescue Exception false end end |
Instance Method Details
#to_s ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/assay/assertions/execution_failure.rb', line 36 def to_s if @_negated "Expected procedure to raise an exception" else "Expected procedure to execute successfully" end end |