eproxus/meck — pull request #75 by horkhe (2012-09-11 05:13:11+00:00)
Title: Feature/honest mocks

Meck is so powerful that it allows mocking non-existent functions and even non-existent modules. But as every coin it comes with two sides. And the bad thing here is that all sorts of problem caused by refactoring/removing/renaming actions are not detected by meck featured unit tests. Namely:
* a mocked module was removed/renamed;
* an expected function was removed/renamed;
* arguments were removed/added to an expected function;

To have such cases detected at the earliest possibility **honest** mocks were introduced. They expose the following properties:
* they are created with **honest** option;
* an attempt to create a mock by meck:new(mod, [honest]) for a module that does not exist fails with undefined_module error;
* an attempt to expect a function that is not exported from the honestly mocked module fails with cannot_mock_fake error.

I personally think that all mocks created by meck should be honest by default, but I did not want to break the backwards compatibility.