Class: Rogue::Support::MockMethods::MockContext
- Inherits:
-
Object
- Object
- Rogue::Support::MockMethods::MockContext
- Defined in:
- lib/rogue/support/mock_methods.rb
Overview
A Mock context allows us to code the mock expectations AFTER the tested method
Instance Method Summary collapse
-
#initialize(block) ⇒ MockContext
constructor
A new instance of MockContext.
- #verify_the_mock(&verify_block) ⇒ Object
Constructor Details
#initialize(block) ⇒ MockContext
Returns a new instance of MockContext.
23 24 25 26 |
# File 'lib/rogue/support/mock_methods.rb', line 23 def initialize(block) @block = block @mock = ::Minitest::Mock.new end |
Instance Method Details
#verify_the_mock(&verify_block) ⇒ Object
28 29 30 31 32 |
# File 'lib/rogue/support/mock_methods.rb', line 28 def verify_the_mock(&verify_block) verify_block&.call(@mock) @block.call(@mock) @mock.verify end |