Skip to content

Commit

Permalink
Merge pull request #445 from mwallner/GH-444
Browse files Browse the repository at this point in the history
(GH-444) Refactor code around Boxstarter specific parameters to make it clearer
  • Loading branch information
pauby authored Oct 14, 2020
2 parents 67e3204 + 648a36c commit 8459d49
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
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

0 comments on commit 8459d49

Please sign in to comment.