From: Jim Weirich Date: 2006-03-21T01:56:32+09:00 Subject: Re: Library for Mocking Jim Weirich wrote: [...] > However, I think automatic parameter > validation could be added without too much effort. Ha! I now know the exact amount of effort to add parameter validation ... Change the method_missing definition in Recorder to read: def method_missing(sym, *args, &block) @mock.should_receive(sym).and_return(&block).with(*args) end (i.e. add ".with(*args)" to the end of the line). Not only do you get parameter validation, but the full range of constraints available to the "should_receive" sytle of specification. For example: FlexMock.use do |mock| mock.should_expect do |recorder| recorder.add(Integer, 4) { |i, f| i + f }.at_least.once end # Test fails if mock.add is not called at least once with # integer for the first argument and the number 4 for the # second argument. end -- -- Jim Weirich -- Posted via http://www.ruby-forum.com/.