diff --git a/CHANGELOG.md b/CHANGELOG.md index eb2e980..4bb238a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,4 +8,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Asserts: - - `Assert-BlockString` + - `Assert-BlockString` (alias `Should-BeBlockString`) diff --git a/source/Public/Assert-BlockString.ps1 b/source/Public/Assert-BlockString.ps1 index f9a3695..167e003 100644 --- a/source/Public/Assert-BlockString.ps1 +++ b/source/Public/Assert-BlockString.ps1 @@ -45,10 +45,10 @@ https://github.com/pester/Pester/commit/c8bc9679bed19c8fbc4229caa01dd083f2d03d4f#diff-b7592dd925696de2521c9b12b966d65519d502045462f002c343caa7c0986936 and https://github.com/pester/Pester/commit/c8bc9679bed19c8fbc4229caa01dd083f2d03d4f#diff-460f64eafc16facefbed201eb00fb151c75eadf7cc58a504a01527015fb1c7cdR17 - #> -function Assert-BlockString # Should-BeBlockString +function Assert-BlockString { + [Alias('Should-BeBlockString')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseProcessBlockForPipelineCommand', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('AvoidThrowOutsideOfTry', '')] param diff --git a/tests/Unit/Public/Assert-BlockString.tests.ps1 b/tests/Unit/Public/Assert-BlockString.tests.ps1 index debe374..44c4416 100644 --- a/tests/Unit/Public/Assert-BlockString.tests.ps1 +++ b/tests/Unit/Public/Assert-BlockString.tests.ps1 @@ -81,4 +81,12 @@ Describe 'Assert-BlockString' { } { & $scriptBlock } | Should -Not -Throw } + + It 'Should be able to be called using its alias' { + $Expected = 'Test string' + $scriptBlock = { + 'Test string' | Should-BeBlockString -Expected $Expected + } + { & $scriptBlock } | Should -Not -Throw + } }