Allow a 'callback' argument to be passed to $() and a new $callback() method

Description

Luis, we discussed this briefly @ SotR.

Currently one can specify a expression to use for a $results() value, and the value of that expression is then used as the results for the mocked method.

It would be occasionally handy for some stub code to be run to provide the results when a mocked method is called. This could be effected by being able to pass a callback to $results(), which is then called to provide the results when the mocked method itself is called.

Ideally a mocked method should always be able to be fairly dumb, but sometimes in an imperfect world where the mocked method has other dependencies which cannot be mocked out, an actual usable result is necessary. We've needed to do this about... hmmm... 0.5% of the times in out unit tests I think, so this is quite edge-case-y.

Cheers.

Activity

Show:
Luis Majano
July 19, 2013, 4:57 PM

I get it now. thanks Adam

Adam Cameron
July 19, 2013, 7:34 AM

Easy:

Luis Majano
July 18, 2013, 12:49 AM

I have been thinking further about this and it causes an issue. What if you really wanted to return a closure or a UDF value?

Fixed

Assignee

Luis Majano

Reporter

Adam Cameron

Labels

None

Components

Fix versions

Affects versions

Priority

Minor