From fd8a9d25ac416f4ef10b8643044afb742abe0cc4 Mon Sep 17 00:00:00 2001 From: Zachary Folwick Date: Fri, 7 Aug 2015 14:12:40 -0700 Subject: [PATCH] added a beforeEach clause --- src/pester-tests/Test-Format-List.Tests.ps1 | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/pester-tests/Test-Format-List.Tests.ps1 b/src/pester-tests/Test-Format-List.Tests.ps1 index 6be3cf037b..1eebdb19e4 100644 --- a/src/pester-tests/Test-Format-List.Tests.ps1 +++ b/src/pester-tests/Test-Format-List.Tests.ps1 @@ -1,24 +1,18 @@ Describe "Test-Format-List" { - It "Should call format list without error" { + BeforeEach { $input = New-Object PSObject Add-Member -InputObject $input -MemberType NoteProperty -Name testName -Value testValue + } + It "Should call format list without error" { { $input | Format-List } | Should Not Throw - } It "Should be able to call the alias" { - $input = New-Object PSObject - Add-Member -InputObject $input -MemberType NoteProperty -Name testName -Value testValue - { $input | fl } | Should Not Throw - } It "Should have the same output whether choosing alias or not" { - $input = New-Object PSObject - Add-Member -InputObject $input -MemberType NoteProperty -Name testName -Value testValue - $expected = $input | Format-List | Out-String $actual = $input | fl | Out-String @@ -78,10 +72,7 @@ Describe "Test-Format-List" { } It "Should be able to take input without piping objects to it" { - $input = New-Object PSObject - Add-Member -InputObject $input -MemberType NoteProperty -Name testName -Value testValue - - $output = { Format-List -InputObject $input } + $output = { Format-List -InputObject $input } $output | Should Not Throw $output | Should Not BeNullOrEmpty