|
| 1 | +Describe "Actions from the root of a drive" -Tag Scenario { |
| 2 | + BeforeAll { |
| 3 | + Initialize-ChocolateyTestInstall |
| 4 | + Push-Location '\' |
| 5 | + Invoke-Choco new roottest --version 1.0.0 |
| 6 | + Remove-Item roottest/tools/*.ps1 -ErrorAction SilentlyContinue |
| 7 | + Invoke-Choco pack roottest/roottest.nuspec |
| 8 | + } |
| 9 | + |
| 10 | + AfterAll { |
| 11 | + Remove-ChocolateyTestInstall |
| 12 | + Remove-Item roottest, roottest.1.0.0.nupkg -Force -Recurse -ErrorAction SilentlyContinue |
| 13 | + Pop-Location |
| 14 | + } |
| 15 | + |
| 16 | + Context "Searching with <_> '.' source at the root of a drive" -ForEach @('find', 'search') { |
| 17 | + BeforeAll { |
| 18 | + $Output = Invoke-Choco $_ --source="'.'" |
| 19 | + } |
| 20 | + |
| 21 | + It 'Exits with Success (0)' { |
| 22 | + $Output.ExitCode | Should -Be 0 -Because $Output.String |
| 23 | + } |
| 24 | + |
| 25 | + It 'Does not output message about being unable to parse a source' { |
| 26 | + $Output.Lines | Should -Not -Contain "Source '.' is unable to be parsed" -Because $Output.String |
| 27 | + } |
| 28 | + |
| 29 | + It "Finds the package expected" { |
| 30 | + $Output.Lines | Should -Contain "roottest 1.0.0" -Because $Output.String |
| 31 | + } |
| 32 | + } |
| 33 | + |
| 34 | + Context "Installing from '.' source using <_> at the root of a drive" -ForEach @( 'install', 'upgrade' ) { |
| 35 | + BeforeAll { |
| 36 | + Restore-ChocolateyInstallSnapshot |
| 37 | + $Output = Invoke-Choco $_ roottest --source="'.'" |
| 38 | + } |
| 39 | + |
| 40 | + AfterAll { |
| 41 | + Remove-ChocolateyInstallSnapshot |
| 42 | + } |
| 43 | + |
| 44 | + It 'Exits with Success (0)' { |
| 45 | + $Output.ExitCode | Should -Be 0 -Because $Output.String |
| 46 | + } |
| 47 | + |
| 48 | + It 'Does not output message about being unable to parse a source' { |
| 49 | + $Output.Lines | Should -Not -Contain "Source '.' is unable to be parsed" -Because $Output.String |
| 50 | + } |
| 51 | + |
| 52 | + It "Finds the package expected" { |
| 53 | + $Output.Lines | Should -Contain "roottest v1.0.0" -Because $Output.String |
| 54 | + } |
| 55 | + |
| 56 | + It "Successfully updates the package" { |
| 57 | + $Action = $_.TrimEnd('e') + 'ed' |
| 58 | + $Output.Lines | Should -Contain "Chocolatey $Action 1/1 packages." -Because $Output.String |
| 59 | + } |
| 60 | + } |
| 61 | +} |
0 commit comments