pester/Pester — pull request #66 by jole78 (2013-08-27 11:19:16+00:00)
Title: Added support for mocking functions inside of modules

I think I've managed to add the ability to mock functions that are called inside of modules. I've shown what I aim to do with a test.

I've implemented the feature with a possibility to add a -scope parameter to the Mock function. (optional of course)

It's a bit tricky to deal with scopes and modules but I think that I've managed to get i right by:

1. Exporting all the functions from the module (possibly with a condition as shown in the test module)
1. The functions that you aim to mock need to be declared as global in the module (the export will limit this anyway)
1. Finding and mocking the functions in the global scope by adding -scope global to the mock function call.