[mocha-developer] mocking missing methods

James Mead jamesmead44 at gmail.com
Wed Apr 25 18:03:34 EDT 2007


Hmm. Interesting. I think I find my examples more readable/logical
than the ones you give, but it's helpful to have someone else's take
on the matter.

Also wouldn't there be difficulties implementing the
responds_like(Sheep.class) version, in that the class() method on any
class object will return Class e.g. Sheep.class # => Class and
Goat.class # => Class.

An example I forgot to mention...

sheep = mock()
sheep.responds_like(Sheep.new)

So responds_like(responder) just needs a responder that responds to
respond_to?() if you see what I mean. The instance_of() method would
be provided so you didn't have to construct an instance of an object
just so you could mock it.

-- 
James.
http://blog.floehopper.org


More information about the mocha-developer mailing list