Add meck:received/3 API for easier history checking #23
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Instead of the unit tester needing to parse the meck:history/1 output for a module and pattern matching for successful or exceptional calls for an {M, F, A} triple inside the test code, the addition of meck:received/3 function makes it easier to read the received calls expectations.
An example might be if you have a CRUD/REST API wrapper around a low-level datastore library, where you want to make sure that on an edit will first read the object/record about to be edited to first check for conflicts (assume you use a read-conflict datastore like CouchDb, Riak, etc.) the unit tester wants to know that the lowleveldb module received a call to read with specific arguments when calling the nicehighlevelapi:edit/1 function:
Eventually I would like to add more ways to do this via the received/3 or received/Other when Other =/= 3 function(s) to offer APIs equivalent to what I am used to using Ruby's RSpec.
I can also add this as a wrapper library around Meck, if you disagree with this the concept of adding this to meck. Thoughts and suggestions are welcome.