{"action":"closed","number":744,"pull_request":{"url":"https://api.github.com/repos/pester/Pester/pulls/744","id":111463146,"html_url":"https://github.com/pester/Pester/pull/744","diff_url":"https://github.com/pester/Pester/pull/744.diff","patch_url":"https://github.com/pester/Pester/pull/744.patch","issue_url":"https://api.github.com/repos/pester/Pester/issues/744","number":744,"state":"closed","locked":false,"title":"Fixes #697 - Mocking a Dummy Function with a Pipeline in two consequitive Context","user":{"login":"dlwyatt","id":5107604,"avatar_url":"https://avatars3.githubusercontent.com/u/5107604?v=3","gravatar_id":"","url":"https://api.github.com/users/dlwyatt","html_url":"https://github.com/dlwyatt","followers_url":"https://api.github.com/users/dlwyatt/followers","following_url":"https://api.github.com/users/dlwyatt/following{/other_user}","gists_url":"https://api.github.com/users/dlwyatt/gists{/gist_id}","starred_url":"https://api.github.com/users/dlwyatt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dlwyatt/subscriptions","organizations_url":"https://api.github.com/users/dlwyatt/orgs","repos_url":"https://api.github.com/users/dlwyatt/repos","events_url":"https://api.github.com/users/dlwyatt/events{/privacy}","received_events_url":"https://api.github.com/users/dlwyatt/received_events","type":"User","site_admin":false},"body":"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.\r\n\r\nThis 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.\r\n\r\nFixes #697","created_at":"2017-03-19T19:10:34Z","updated_at":"2017-03-22T19:04:19Z","closed_at":"2017-03-22T19:04:19Z","merged_at":"2017-03-22T19:04:19Z","merge_commit_sha":"cc9c970990e874f018ba1e4888583a791c26a247","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/pester/Pester/pulls/744/commits","review_comments_url":"https://api.github.com/repos/pester/Pester/pulls/744/comments","review_comment_url":"https://api.github.com/repos/pester/Pester/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pester/Pester/issues/744/comments","statuses_url":"https://api.github.com/repos/pester/Pester/statuses/7bf3ed5731e0e31964f1c1866bcb632d77450d4a","head":{"label":"dlwyatt:MockFix","ref":"MockFix","sha":"7bf3ed5731e0e31964f1c1866bcb632d77450d4a","user":{"login":"dlwyatt","id":5107604,"avatar_url":"https://avatars3.githubusercontent.com/u/5107604?v=3","gravatar_id":"","url":"https://api.github.com/users/dlwyatt","html_url":"https://github.com/dlwyatt","followers_url":"https://api.github.com/users/dlwyatt/followers","following_url":"https://api.github.com/users/dlwyatt/following{/other_user}","gists_url":"https://api.github.com/users/dlwyatt/gists{/gist_id}","starred_url":"https://api.github.com/users/dlwyatt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dlwyatt/subscriptions","organizations_url":"https://api.github.com/users/dlwyatt/orgs","repos_url":"https://api.github.com/users/dlwyatt/repos","events_url":"https://api.github.com/users/dlwyatt/events{/privacy}","received_events_url":"https://api.github.com/users/dlwyatt/received_events","type":"User","site_admin":false},"repo":{"id":20619230,"name":"Pester","full_name":"dlwyatt/Pester","owner":{"login":"dlwyatt","id":5107604,"avatar_url":"https://avatars3.githubusercontent.com/u/5107604?v=3","gravatar_id":"","url":"https://api.github.com/users/dlwyatt","html_url":"https://github.com/dlwyatt","followers_url":"https://api.github.com/users/dlwyatt/followers","following_url":"https://api.github.com/users/dlwyatt/following{/other_user}","gists_url":"https://api.github.com/users/dlwyatt/gists{/gist_id}","starred_url":"https://api.github.com/users/dlwyatt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dlwyatt/subscriptions","organizations_url":"https://api.github.com/users/dlwyatt/orgs","repos_url":"https://api.github.com/users/dlwyatt/repos","events_url":"https://api.github.com/users/dlwyatt/events{/privacy}","received_events_url":"https://api.github.com/users/dlwyatt/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dlwyatt/Pester","description":"Powershell BDD style testing framework","fork":true,"url":"https://api.github.com/repos/dlwyatt/Pester","forks_url":"https://api.github.com/repos/dlwyatt/Pester/forks","keys_url":"https://api.github.com/repos/dlwyatt/Pester/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dlwyatt/Pester/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dlwyatt/Pester/teams","hooks_url":"https://api.github.com/repos/dlwyatt/Pester/hooks","issue_events_url":"https://api.github.com/repos/dlwyatt/Pester/issues/events{/number}","events_url":"https://api.github.com/repos/dlwyatt/Pester/events","assignees_url":"https://api.github.com/repos/dlwyatt/Pester/assignees{/user}","branches_url":"https://api.github.com/repos/dlwyatt/Pester/branches{/branch}","tags_url":"https://api.github.com/repos/dlwyatt/Pester/tags","blobs_url":"https://api.github.com/repos/dlwyatt/Pester/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dlwyatt/Pester/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dlwyatt/Pester/git/refs{/sha}","trees_url":"https://api.github.com/repos/dlwyatt/Pester/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dlwyatt/Pester/statuses/{sha}","languages_url":"https://api.github.com/repos/dlwyatt/Pester/languages","stargazers_url":"https://api.github.com/repos/dlwyatt/Pester/stargazers","contributors_url":"https://api.github.com/repos/dlwyatt/Pester/contributors","subscribers_url":"https://api.github.com/repos/dlwyatt/Pester/subscribers","subscription_url":"https://api.github.com/repos/dlwyatt/Pester/subscription","commits_url":"https://api.github.com/repos/dlwyatt/Pester/commits{/sha}","git_commits_url":"https://api.github.com/repos/dlwyatt/Pester/git/commits{/sha}","comments_url":"https://api.github.com/repos/dlwyatt/Pester/comments{/number}","issue_comment_url":"https://api.github.com/repos/dlwyatt/Pester/issues/comments{/number}","contents_url":"https://api.github.com/repos/dlwyatt/Pester/contents/{+path}","compare_url":"https://api.github.com/repos/dlwyatt/Pester/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dlwyatt/Pester/merges","archive_url":"https://api.github.com/repos/dlwyatt/Pester/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dlwyatt/Pester/downloads","issues_url":"https://api.github.com/repos/dlwyatt/Pester/issues{/number}","pulls_url":"https://api.github.com/repos/dlwyatt/Pester/pulls{/number}","milestones_url":"https://api.github.com/repos/dlwyatt/Pester/milestones{/number}","notifications_url":"https://api.github.com/repos/dlwyatt/Pester/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dlwyatt/Pester/labels{/name}","releases_url":"https://api.github.com/repos/dlwyatt/Pester/releases{/id}","deployments_url":"https://api.github.com/repos/dlwyatt/Pester/deployments","created_at":"2014-06-08T15:12:27Z","updated_at":"2016-02-14T21:32:42Z","pushed_at":"2017-03-22T18:43:56Z","git_url":"git://github.com/dlwyatt/Pester.git","ssh_url":"git@github.com:dlwyatt/Pester.git","clone_url":"https://github.com/dlwyatt/Pester.git","svn_url":"https://github.com/dlwyatt/Pester","homepage":"","size":9469,"stargazers_count":0,"watchers_count":0,"language":"PowerShell","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"pester:master","ref":"master","sha":"27c061c2f29be9e86f9977086c0c40e67ae0a5e3","user":{"login":"pester","id":2376848,"avatar_url":"https://avatars0.githubusercontent.com/u/2376848?v=3","gravatar_id":"","url":"https://api.github.com/users/pester","html_url":"https://github.com/pester","followers_url":"https://api.github.com/users/pester/followers","following_url":"https://api.github.com/users/pester/following{/other_user}","gists_url":"https://api.github.com/users/pester/gists{/gist_id}","starred_url":"https://api.github.com/users/pester/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pester/subscriptions","organizations_url":"https://api.github.com/users/pester/orgs","repos_url":"https://api.github.com/users/pester/repos","events_url":"https://api.github.com/users/pester/events{/privacy}","received_events_url":"https://api.github.com/users/pester/received_events","type":"Organization","site_admin":false},"repo":{"id":1213474,"name":"Pester","full_name":"pester/Pester","owner":{"login":"pester","id":2376848,"avatar_url":"https://avatars0.githubusercontent.com/u/2376848?v=3","gravatar_id":"","url":"https://api.github.com/users/pester","html_url":"https://github.com/pester","followers_url":"https://api.github.com/users/pester/followers","following_url":"https://api.github.com/users/pester/following{/other_user}","gists_url":"https://api.github.com/users/pester/gists{/gist_id}","starred_url":"https://api.github.com/users/pester/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pester/subscriptions","organizations_url":"https://api.github.com/users/pester/orgs","repos_url":"https://api.github.com/users/pester/repos","events_url":"https://api.github.com/users/pester/events{/privacy}","received_events_url":"https://api.github.com/users/pester/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pester/Pester","description":"PowerShell BDD style testing framework","fork":false,"url":"https://api.github.com/repos/pester/Pester","forks_url":"https://api.github.com/repos/pester/Pester/forks","keys_url":"https://api.github.com/repos/pester/Pester/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pester/Pester/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pester/Pester/teams","hooks_url":"https://api.github.com/repos/pester/Pester/hooks","issue_events_url":"https://api.github.com/repos/pester/Pester/issues/events{/number}","events_url":"https://api.github.com/repos/pester/Pester/events","assignees_url":"https://api.github.com/repos/pester/Pester/assignees{/user}","branches_url":"https://api.github.com/repos/pester/Pester/branches{/branch}","tags_url":"https://api.github.com/repos/pester/Pester/tags","blobs_url":"https://api.github.com/repos/pester/Pester/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pester/Pester/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pester/Pester/git/refs{/sha}","trees_url":"https://api.github.com/repos/pester/Pester/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pester/Pester/statuses/{sha}","languages_url":"https://api.github.com/repos/pester/Pester/languages","stargazers_url":"https://api.github.com/repos/pester/Pester/stargazers","contributors_url":"https://api.github.com/repos/pester/Pester/contributors","subscribers_url":"https://api.github.com/repos/pester/Pester/subscribers","subscription_url":"https://api.github.com/repos/pester/Pester/subscription","commits_url":"https://api.github.com/repos/pester/Pester/commits{/sha}","git_commits_url":"https://api.github.com/repos/pester/Pester/git/commits{/sha}","comments_url":"https://api.github.com/repos/pester/Pester/comments{/number}","issue_comment_url":"https://api.github.com/repos/pester/Pester/issues/comments{/number}","contents_url":"https://api.github.com/repos/pester/Pester/contents/{+path}","compare_url":"https://api.github.com/repos/pester/Pester/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pester/Pester/merges","archive_url":"https://api.github.com/repos/pester/Pester/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pester/Pester/downloads","issues_url":"https://api.github.com/repos/pester/Pester/issues{/number}","pulls_url":"https://api.github.com/repos/pester/Pester/pulls{/number}","milestones_url":"https://api.github.com/repos/pester/Pester/milestones{/number}","notifications_url":"https://api.github.com/repos/pester/Pester/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pester/Pester/labels{/name}","releases_url":"https://api.github.com/repos/pester/Pester/releases{/id}","deployments_url":"https://api.github.com/repos/pester/Pester/deployments","created_at":"2011-01-02T03:33:19Z","updated_at":"2017-03-22T18:03:54Z","pushed_at":"2017-03-22T19:04:19Z","git_url":"git://github.com/pester/Pester.git","ssh_url":"git@github.com:pester/Pester.git","clone_url":"https://github.com/pester/Pester.git","svn_url":"https://github.com/pester/Pester","homepage":"","size":9459,"stargazers_count":986,"watchers_count":986,"language":"PowerShell","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":214,"mirror_url":null,"open_issues_count":177,"forks":214,"open_issues":177,"watchers":986,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pester/Pester/pulls/744"},"html":{"href":"https://github.com/pester/Pester/pull/744"},"issue":{"href":"https://api.github.com/repos/pester/Pester/issues/744"},"comments":{"href":"https://api.github.com/repos/pester/Pester/issues/744/comments"},"review_comments":{"href":"https://api.github.com/repos/pester/Pester/pulls/744/comments"},"review_comment":{"href":"https://api.github.com/repos/pester/Pester/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pester/Pester/pulls/744/commits"},"statuses":{"href":"https://api.github.com/repos/pester/Pester/statuses/7bf3ed5731e0e31964f1c1866bcb632d77450d4a"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"nohwnd","id":5735905,"avatar_url":"https://avatars1.githubusercontent.com/u/5735905?v=3","gravatar_id":"","url":"https://api.github.com/users/nohwnd","html_url":"https://github.com/nohwnd","followers_url":"https://api.github.com/users/nohwnd/followers","following_url":"https://api.github.com/users/nohwnd/following{/other_user}","gists_url":"https://api.github.com/users/nohwnd/gists{/gist_id}","starred_url":"https://api.github.com/users/nohwnd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nohwnd/subscriptions","organizations_url":"https://api.github.com/users/nohwnd/orgs","repos_url":"https://api.github.com/users/nohwnd/repos","events_url":"https://api.github.com/users/nohwnd/events{/privacy}","received_events_url":"https://api.github.com/users/nohwnd/received_events","type":"User","site_admin":false},"comments":0,"review_comments":0,"maintainer_can_modify":false,"commits":4,"additions":69,"deletions":81,"changed_files":2}}
{"actor":{"display_login":"nohwnd"}}