Class: Bacon::Specification
- Inherits:
-
Object
- Object
- Bacon::Specification
- Includes:
- Mocha::API
- Defined in:
- lib/mocha-on-bacon.rb
Instance Method Summary collapse
- #execute_block ⇒ Object
- #execute_block_before_mocha ⇒ Object
- #finalize ⇒ Object
- #finalize_before_mocha ⇒ Object
- #run ⇒ Object
- #run_before_mocha ⇒ Object
Instance Method Details
#execute_block ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/mocha-on-bacon.rb', line 27 def execute_block execute_block_before_mocha do begin yield rescue Mocha::ExpectationError => e raise Error.new(:failed, e.).tap {|ne| ne.set_backtrace(e.backtrace) } end end end |
#execute_block_before_mocha ⇒ Object
26 |
# File 'lib/mocha-on-bacon.rb', line 26 alias_method :execute_block_before_mocha, :execute_block |
#finalize ⇒ Object
38 39 40 41 42 43 44 45 46 |
# File 'lib/mocha-on-bacon.rb', line 38 def finalize # If an exception already occurred, we don't need to verify Mocha # expectations anymore, as the test has already failed. unless @exception_occurred execute_block { @context.mocha_verify(MochaRequirementsCounter) } end @context.mocha_teardown finalize_before_mocha end |
#finalize_before_mocha ⇒ Object
37 |
# File 'lib/mocha-on-bacon.rb', line 37 alias_method :finalize_before_mocha, :finalize |
#run ⇒ Object
21 22 23 24 |
# File 'lib/mocha-on-bacon.rb', line 21 def run @context.mocha_setup run_before_mocha end |
#run_before_mocha ⇒ Object
20 |
# File 'lib/mocha-on-bacon.rb', line 20 alias_method :run_before_mocha, :run |