Merge pull request #475 from rivy/fix-tests

fix/improve Scoop-Alias and Scoop-Core tests
This commit is contained in:
Simon Hartcher
2015-08-26 14:13:39 +10:00
2 changed files with 14 additions and 14 deletions
+9 -13
View File
@@ -1,12 +1,14 @@
. "$psscriptroot\..\libexec\scoop-alias.ps1"
. "$psscriptroot\..\libexec\scoop-alias.ps1" | out-null
reset_aliases
describe "add_alias" {
mock shimdir { "test\fixtures\shim" }
mock shimdir { "TestDrive:\shim" }
mock set_config { }
mock get_config { @{} }
$shimdir = shimdir
mkdir $shimdir
context "alias doesn't exist" {
it "creates a new alias" {
@@ -28,18 +30,16 @@ describe "add_alias" {
$alias_file | should contain ""
}
}
aftereach {
rm "test\fixtures\shim\scoop-rm.ps1" -ea ignore
}
}
describe "rm_alias" {
mock shimdir { "test\fixtures\shim" }
$shimdir = shimdir
mock shimdir { "TestDrive:\shim" }
mock set_config { }
mock get_config { @{} }
$shimdir = shimdir
mkdir $shimdir
context "alias exists" {
it "removes an existing alias" {
$alias_file = "$shimdir\scoop-rm.ps1"
@@ -52,8 +52,4 @@ describe "rm_alias" {
$alias_file | should not exist
}
}
afterall {
rm "test\fixtures\shim\scoop-rm.ps1" -ea ignore
}
}
}
+5 -1
View File
@@ -2,6 +2,8 @@
. "$psscriptroot\..\lib\install.ps1"
. "$psscriptroot\Scoop-TestLib.ps1"
$repo_dir = (Get-Item $MyInvocation.MyCommand.Path).directory.parent.FullName
describe "movedir" {
$extract_dir = "subdir"
$extract_to = $null
@@ -59,7 +61,9 @@ describe "unzip_old" {
it "unzips file with zero bytes without error" {
$to = test-unzip $zerobyte
$to | should not be $null
$to | should exist
(gci $to).count | should be 0
}
}
@@ -136,7 +140,7 @@ describe "rm_shim" {
describe "ensure_robocopy_in_path" {
$shimdir = shimdir $false
mock versiondir { ".\" }
mock versiondir { $repo_dir }
beforeall {
reset_aliases