Gary Shea schrieb:
> Mockery (http://rubyforge.org/projects/mockery) is a Ruby version of the
> kind of dynamic mock generator that is commonplace in Java.  The Java
> versions tend to do a lousy job mocking classes as opposed to
> interfaces, but we don't have that problem in Ruby (not only are there
> no interfaces, but dynamic class modification is SO easy it's just not
> an issue).
> 
> A first draft of the above example using Mockery looks like:
> 
>   ctl = Mockery::Controller.new(Some::Klass)
>   ctl.record do |x|
>     x.doit('blah')
>   end
>   ctl.try do |x|
>     x.please_call_doit('blah')
>   end
>   assert_equal(true, ctl.validate, ctl.error_report)

Nice work! I will try it if I need mocks in my unit tests. One first 
question: couldn't you put the last assert into the #try method? 
Something like

   def try
     ...
   ensure
     assert_equal(true, validate, error_report)
   end

Regards,
Pit