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

(GH-444) Refactor code around Boxstarter specific parameters to make it clearer #445

Merged
merged 1 commit into from
Oct 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Boxstarter.Chocolatey/Chocolatey.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ function chocolatey {
$skipNextArg = $true
continue;
}
if (@("-StopOnPackageFailure", "--StopOnPackageFailure" -contains $a)) {
if (@("-StopOnPackageFailure", "--StopOnPackageFailure") -contains $a) {
continue;
}
$argsWithoutBoxstarterSpecials += $a
Expand Down
20 changes: 20 additions & 0 deletions tests/Chocolatey/Chocolatey.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,26 @@ Describe "Call-Chocolatey" {
$passedArgs[7] | Should Be "-Verbose"
}
}

context "package parameters - Boxstarter exclusive parameters are stripped" {
$script:passedArgs = ""
Mock Invoke-LocalChocolatey { $script:passedArgs = $chocoArgs }

choco Install -y pkg -RebootCodes 123 --source blah --StopOnPackageFailure

$passedArgs | Should Not BeNullOrEmpty

it "passes expected params" {
$passedArgs.count | Should Be 5
}
it "passes all parameters in correct order" {
$passedArgs[0] | Should Be "Install"
$passedArgs[1] | Should Be "pkg" # package will always be first argument (reordering happens!)
$passedArgs[2] | Should Be "-y" # passed -y is after package because of the reordering
$passedArgs[3] | Should Be "--source"
$passedArgs[4] | Should Be "blah"
}
}
}

Describe "Get-PackageNamesFromInvocationLine" {
Expand Down