Skip to content

Commit

Permalink
- Record mocked calls before they happen so mocks can raise exception…
Browse files Browse the repository at this point in the history
…s easier (tho I'm not a fan). (corecode)

[git-p4: depot-paths = "//src/minitest/dev/": change = 9949]
  • Loading branch information
zenspider committed Jan 21, 2015
1 parent 7298fce commit 0ddacc6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/minitest/mock.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,12 @@ def method_missing(sym, *args, &block) # :nodoc:
expected_call.values_at(:args, :retval, :block)

if val_block then
# keep "verify" happy
@actual_calls[sym] << expected_call

raise MockExpectationError, "mocked method %p failed block w/ %p" %
[sym, args] unless val_block.call(*args, &block)

# keep "verify" happy
@actual_calls[sym] << expected_call
return retval
end

Expand Down

0 comments on commit 0ddacc6

Please sign in to comment.