Another testing question: is there an easy way to ...
# development
b
Another testing question: is there an easy way to mock the behavior of a
Process
invocation that I know my rule is going to make?
e
I'm not sure besides stitching in a rule to go Process -> <forget the return type> to take the place of the ~build-in rule.
RuleRunner.replace(Input, Output, @rule) might be handy if it existed. I'm pretty sure this is not easy today.
You can mock Gets somewhere though ...
b
Mocking Gets would probably be fine as long as I had the ability to selectively return a result for only the Get I care about
e
I think you must ock them all.
Basically you need to provide an input for every edge into your @rule under test.
b
Hmmm, seems like we could either check a caller-provided matching predicate against
subject
here, and then fall back to a "real" rule graph if nothing matched
But realistically I suppose I don't need that, I can just stick to precisely unit testing rules that make the
Process
calls I care about. Their direct dependencies shouldn't be hard to mock in