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.
145 146 147 148 149 150 151 152 153 |
# File 'lib/minitest/mock.rb', line 145 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 |