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

Support for should.not_be #38

Merged
merged 1 commit into from
Dec 24, 2012
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
6 changes: 5 additions & 1 deletion Examples/Calculator/Add-Numbers.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,9 @@ Describe "Add-Numbers" {
$sum = Add-Numbers two three
$sum.should.be("twothree")
}


It "should not be 0" {
$sum = Add-Numbers 2 3
$sum.should.not_be(0)
}
}
7 changes: 7 additions & 0 deletions ObjectAdaptations/types.ps1xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
param($expected)
if ($expected -ne $this.actual) {throw New-Object PesterFailure($expected,$this.actual)}
} -PassThru |
Add-Member ScriptMethod not_be {
param($expected)
if ($expected -eq $this.actual) {throw New-Object PesterFailure($expected,$this.actual)}
} -PassThru |
Add-Member ScriptMethod have_count_of {
param($expected_count)

Expand All @@ -23,6 +27,9 @@
Add-Member ScriptMethod exist {
if (-not (Test-Path $this.actual)) { throw New-Object PesterFailure("$($this.actual) should exist","$($this.actual) not found")}
} -PassThru |
Add-Member ScriptMethod not_exist {
if (Test-Path $this.actual) { throw New-Object PesterFailure("$($this.actual) should not exist","$($this.actual) exists")}
} -PassThru |
Add-Member ScriptMethod match {
param($expected_match)
$matches = ($this.actual) |? { $_ -match $expected_match }
Expand Down