🕷 zenspider.com

by ryan davis



sitemap
Looking for the Ruby Quickref?

minitest mock -- which is more important?

Published 2012-04-27 @ 16:13

Tagged minitest

Currently you can do something like this with minitest/mock:

1
2
3
4
5
6
7
8
9
mock = MiniTest::Mock.new

mock.expect :foo, nil

mock.foo
mock.foo
mock.foo # and so on... you can call until the cows come home

mock.verify

but you can’t do the following:

1
2
3
4
5
6
7
8
9
mock = MiniTest::Mock.new

mock.expect :foo, nil
mock.expect :foo, true

assert_equal nil,  mock.foo
assert_equal true, mock.foo

mock.verify

minitest/mock currently accesses mocked calls by arity and the first one wins.

I want to break the former and fix the latter. Which is more important to you?