[mocha-developer] Expect with "real world" returns?
Carl Mercier
carl at carlmercier.com
Tue May 20 14:50:16 EDT 2008
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
More information about the mocha-developer
mailing list