I have seen Spock tests where mocks are wired up & configured in the given block (which is where it makes the most sense to me), as well as cases where the only way to get the test to pass required me to wire/configure the mocks inside the then block, which is just plain silly to me. An example of the latter is a question that I asked some time ago.
So I ask: What determines where to actually wire/config a mock, either in given or in then? I really hope the answer isn't just "keep playing with it until it works", because that's too non-deterministic for my tiny robot brain.
Aucun commentaire:
Enregistrer un commentaire