Brian Takita discusses this functionality in his RR mocking framework
under the moniker Mock Proxy.
http://pivots.pivotallabs.com/users/brian/blog/articles/352-introducing-rr
Not sure if I've posted to this about the pattern before, but it looks
really useful, especially if it could be combined with traditional
mocking techniques.
On Tue, May 20, 2008 at 11:50 AM, Carl Mercier <carl at carlmercier.com> wrote:
> Is there a way to do something like this?
>> class Foo
> def self.hello(name)
> "Hello #{name}!"
> end
> end
>> Foo.expects(:bar).with("Carl").once
>> assert_equal "Hello Carl!", Foo.hello
>> Basically, my problem is that once you set an expectation, the original code
> is never executed and is not tested. However, it's still very useful to set
> expectations to make sure the right arguments are passed to certain methods.
> The above example surely is over simplistic, but in a real world scenario,
> it totally makes sense.
>> Is it possible to do something like this in Mocha as it is right now. If
> not, is that something you'd consider implementing?
>> Thanks!
>> /carl
>>>>>>>> _______________________________________________
> mocha-developer mailing list
>mocha-developer at rubyforge.org>http://rubyforge.org/mailman/listinfo/mocha-developer>