Michael Schuerig wrote:
> Charles Steinman wrote:
> 
> 
>>Michael Schuerig wrote:
>>
>>>For unit tests I've written a mock object that should check its
>>>arguments against expected arguments using assertions from
>>>Test::Unit::Assertions. For instance methods I can include
>>>Test::Unit::Assertions in the mock class, that's easy. But how can I
>>>use these assertions in a class method?
>>
>>Include them in the mock class's singleton class.
>>
>>--- (untested code, but should work) ---
>>class MockClass
>>  include Test::Unit::Assertions
>>
>>  class << self # To get the singleton class
>>    include Test::Unit::Assertions
>>  end
>>
>>  # Whatever methods need to use the assertions
>>end
>>---
> 
> 
> Thanks, yes, that works, too. I'll need to work with the Ruby object
> model some more to become really comfortable with it.

Using #include on the class's signleton class is the same as using
#extend on the class itself, IIRC, so it's not really as confusing as it
sounds at first :)