Method: Minitest::Mock#verify
- Defined in:
- lib/minitest/mock.rb
#verify ⇒ Object
Verify that all methods were called as expected. Raises MockExpectationError
if the mock object was not called as expected.
142 143 144 145 146 147 148 149 150 |
# File 'lib/minitest/mock.rb', line 142 def verify @expected_calls.each do |name, expected| actual = @actual_calls.fetch name, nil # defaults to [] raise MockExpectationError, "expected #{__call name, expected[0]}" unless actual raise MockExpectationError, "expected #{__call name, expected[actual.size]}, got [#{__call name, actual}]" if actual.size < expected.size end true end |