Exception: ExecutionAssay
- Defined in:
- lib/assay/execution_assay.rb
Overview
Assert that a block of coded executes without error and does not return nil
or false
.
NOTE: To test only for successful execution regardless of return value use a negated RaiseAssay on the Exception class. But generally this would be pretty silly, if you think about it, this is exactly what testing is for!
Direct Known Subclasses
Constant Summary
Constants inherited from Assertion
Constants included from Assay::Assertable
Class Method Summary collapse
- .assert_message(*arguments, &block) ⇒ Object
-
.fail?(*arguments, &block) ⇒ Boolean
Check negated assertion.
-
.pass?(*arguments, &block) ⇒ Boolean
Check assertion.
Methods inherited from Assertion
by_name, by_operator, inherited, register, subclasses
Methods included from Assay::Assertable
#[], #assert!, #assert_message, #assertive_name, #assertor, #fail?, #operator, #pass?, #refute!, #refute_message
Class Method Details
.assert_message(*arguments, &block) ⇒ Object
54 55 56 |
# File 'lib/assay/execution_assay.rb', line 54 def self.(*arguments, &block) "#{block}.call(*#{arguments.inspect})" end |
.fail?(*arguments, &block) ⇒ Boolean
Check negated assertion.
29 30 31 32 33 34 35 |
# File 'lib/assay/execution_assay.rb', line 29 def self.fail?(*arguments, &block) begin ! block.call(*arguments) rescue Exception true end end |
.pass?(*arguments, &block) ⇒ Boolean
Check assertion.
18 19 20 21 22 23 24 |
# File 'lib/assay/execution_assay.rb', line 18 def self.pass?(*arguments, &block) begin block.call(*arguments) rescue Exception false end end |