Public/Get-PsModuleBuilderPath.tests.ps1
$here = Split-Path -Parent $MyInvocation.MyCommand.Path $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -replace '\.Tests\.', '.' . "$here\$sut" . "$here\Set-PsModuleBuilderPath.ps1" Describe "Get-PsModuleBuilderPath" { Context "When moduleBuilderPath is not set..." { $dataPath = "$PsScriptRoot\..\Data\psmodulebuilderpath.xml" Remove-Item $dataPath -Force -ErrorAction SilentlyContinue $actual = Get-PsModuleBuilderPath $expected = Import-CliXml -Path $dataPath It "Should call Set-PsModuleBuilderPath -Default" { $actual | Should -Be $expected } } Context "When moduleBuilderPath is set..." { $testPath = "TestDrive:\Modules" New-Item $testPath -ItemType Directory -Force | Out-Null Set-PsModuleBuilderPath $testPath $actual = Get-PsModuleBuilderPath It "Should return a directory path" { Test-Path $actual -PathType Container | Should -Be $true } } } |