Skip to content

Commit

Permalink
✅ accept failures from allusers
Browse files Browse the repository at this point in the history
User may not have access to the all users path, that's expected.
  • Loading branch information
vexx32 committed Jun 18, 2020
1 parent 367e6a1 commit 648c8ea
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Tests/Functions/Public/Register-Advice.Tests.ps1
Expand Up @@ -49,7 +49,15 @@ Describe "Register-Advice" {
@{ ProfilePath = 'CurrentUserAllHosts' }
@{ ProfilePath = 'CurrentUserCurrentHost' }
) {
Register-Advice $ProfilePath | Should -BeNullOrEmpty
try {
Register-Advice $ProfilePath | Should -BeNullOrEmpty
}
catch [UnauthorizedAccessException] {
# Current user doesn't have access to the profile path. This can be normal for the 'AllUsers' paths.
if ($ProfilePath -notmatch '^AllUsers') {
throw $_
}
}
}
}
}

0 comments on commit 648c8ea

Please sign in to comment.