Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #697 - Mocking a Dummy Function with a Pipeline in two consequitive Context #744

Merged
merged 4 commits into from
Mar 22, 2017

Conversation

dlwyatt
Copy link
Member

@dlwyatt dlwyatt commented Mar 19, 2017

In the past we've been renaming functions back and forth when mocking an existing function. Apparently we've been lucky that this worked at all, because when we rename the function back, we can wind up modifying its scope.

This PR changes the approach: we never modify the original command, even if it's a function. Instead, we create an alias with the same name (which takes precedence anyway), and point that alias to our mock's bootstrap function that can exist under any name. (Using GUIDs to ensure uniqueness.) When we delete the alias, the original unmocked version of the command goes back to being in effect without any tampering on Pester's part.

Fixes #697

@dlwyatt dlwyatt changed the title Mock fix Fix #697 Mar 19, 2017
@dlwyatt dlwyatt changed the title Fix #697 Fixes #697 Mar 19, 2017
@dlwyatt dlwyatt changed the base branch from DevelopmentV4 to master March 19, 2017 20:40
@nohwnd nohwnd changed the title Fixes #697 Fixes #697 - Mocking a Dummy Function with a Pipeline in two consequitive Context Mar 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants