-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
183 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
Feature: Configure Command From Working Directory | ||
|
||
There is a command to support loading default parameter values from the working directory | ||
|
||
Background: | ||
Given the configuration module is imported with testing paths: | ||
| Enterprise | User | Machine | | ||
| TestDrive:/EnterprisePath | TestDrive:/UserPath | TestDrive:/MachinePath | | ||
|
||
@Functions @Import | ||
Scenario: Loading Default Settings | ||
Given a passthru command 'Test-Verb' with UserName and Age parameters | ||
And a settings file named Verb.psd1 in the current folder | ||
""" | ||
@{ | ||
UserName = 'Joel' | ||
Age = 42 | ||
} | ||
""" | ||
When I call Test-Verb | ||
Then the output object's use rName should be Joel | ||
And the output object's Age should be 42 | ||
|
||
@Functions @Import | ||
Scenario: Overriding Default Settings | ||
Given a passthru command 'Test-Verb' with UserName and Age parameters | ||
And a settings file named Verb.psd1 in the current folder | ||
""" | ||
@{ | ||
UserName = 'Joel' | ||
Age = 42 | ||
} | ||
""" | ||
When I call Test-Verb Mark | ||
Then the output object's userName should be Mark | ||
And the output object's Age should be 42 | ||
|
||
@Functions @Import | ||
Scenario: Overriding Default Settings Works on any Parameter | ||
Given a passthru command 'Test-Verb' with UserName and Age parameters | ||
And a settings file named Verb.psd1 in the current folder | ||
""" | ||
@{ | ||
UserName = 'Joel' | ||
Age = 42 | ||
} | ||
""" | ||
When I call Test-Verb -Age 10 | ||
Then the output object's userName should be Joel | ||
And the output object's Age should be 10 | ||
|
||
@Functions @Import | ||
Scenario: New-User Example | ||
Given an example New-User command | ||
And a settings file named User.psd1 in the current folder | ||
""" | ||
@{ | ||
Domain = 'HuddledMasses.org' | ||
} | ||
""" | ||
When I call New-User Joel Bennett | ||
Then the output object's EMail should be Joel.Bennett@HuddledMasses.org | ||
|
||
@Functions @Import | ||
Scenario: New-User Example Two (overwriting) | ||
Given an example New-User command | ||
And a settings file named User.psd1 in the current folder | ||
""" | ||
@{ | ||
Permissions = @{ | ||
Access = "Administrator" | ||
} | ||
} | ||
""" | ||
And a settings file named User.psd1 in the parent folder | ||
""" | ||
@{ | ||
Department = "Security" | ||
Permissions = @{ | ||
Access = "User" | ||
} | ||
} | ||
""" | ||
And a settings file named User.psd1 | ||
""" | ||
@{ | ||
Domain = "HuddledMasses.org" | ||
} | ||
""" | ||
When I call New-User Joel Bennett | ||
Then the output object's EMail should be Joel.Bennett@HuddledMasses.org | ||
And the output object's Department should be Security | ||
And the output object's Permissions should be of type [hashtable] | ||
And the output object's Permissions.Access should be Administrator | ||
|
||
|
||
@Functions @Import | ||
Scenario: New-User Example Three | ||
Given an example New-User command | ||
And a settings file named SecurityUser.psd1 in the current folder | ||
""" | ||
@{ | ||
Domain = 'HuddledMasses.org' | ||
Permissions = @{ | ||
Access = "Administrator" | ||
} | ||
} | ||
""" | ||
When I call New-User Joel Bennett -Department Security | ||
Then the output object's EMail should be Joel.Bennett@HuddledMasses.org | ||
And the output object's Permissions should be of type [hashtable] | ||
And the output object's Permissions.Access should be of type [string] | ||
And the output object's Permissions.Access should be Administrator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,113 +1,58 @@ | ||
Feature: Configure Command From Working Directory | ||
Feature: Get PSBoundParameters plus default values plus a config file | ||
|
||
There is a command to support loading default parameter values from the working directory | ||
There is a command to support merging PSBoundParameters with parmeter default values | ||
That command supports overwriting the default values with values from a config file | ||
|
||
Background: | ||
Given the configuration module is imported with testing paths: | ||
| Enterprise | User | Machine | | ||
| TestDrive:/EnterprisePath | TestDrive:/UserPath | TestDrive:/MachinePath | | ||
Given the configuration module is imported | ||
|
||
@Functions @Import | ||
@Functions @ParameterValue | ||
Scenario: Loading Default Settings | ||
Given a passthru command 'Test-Verb' with UserName and Age parameters | ||
And a settings file named Verb.psd1 in the current folder | ||
""" | ||
@{ | ||
UserName = 'Joel' | ||
Age = 42 | ||
} | ||
""" | ||
When I call Test-Verb | ||
Then the output object's userName should be Joel | ||
Given a passthru command 'Test-Verb' with UserName and Age=42 parameters that calls Get-ParameterValue | ||
When I call Test-Verb Joel | ||
Then the output object's UserName should be Joel | ||
And the output object's Age should be 42 | ||
|
||
@Functions @Import | ||
@Functions @ParameterValue | ||
Scenario: Loading Default Settings | ||
Given a passthru command 'Test-Verb' with UserName and Age=12 parameters that calls Get-ParameterValue | ||
When I call Test-Verb Joel | ||
Then the output object's UserName should be Joel | ||
And the output object's Age should be 12 | ||
|
||
@Functions @ParameterValue | ||
Scenario: Overriding Default Settings | ||
Given a passthru command 'Test-Verb' with UserName and Age parameters | ||
Given a passthru command 'Test-Verb' with UserName='Sarah' and Age=12 parameters that calls Get-ParameterValue | ||
When I call Test-Verb Joel 24 | ||
Then the output object's UserName should be Joel | ||
And the output object's Age should be 24 | ||
|
||
@Functions @ParameterValue | ||
Scenario: Configuration file | ||
Given a passthru command 'Test-Verb' with UserName='Sarah' and Age=12 parameters that calls Get-ParameterValue with a file config | ||
And a settings file named Verb.psd1 in the current folder | ||
""" | ||
@{ | ||
UserName = 'Joel' | ||
Age = 42 | ||
} | ||
""" | ||
When I call Test-Verb Mark | ||
Then the output object's userName should be Mark | ||
And the output object's Age should be 42 | ||
When I call Test-Verb -Age 10 | ||
Then the output object's userName should be Joel | ||
And the output object's Age should be 10 | ||
|
||
@Functions @Import | ||
Scenario: Overriding Default Settings Works on any Parameter | ||
Given a passthru command 'Test-Verb' with UserName and Age parameters | ||
@Functions @ParameterValue | ||
Scenario: Configuration file with aliases | ||
Given a passthru command 'Test-Verb' with UserName='Sarah' and Age=12 parameters that calls Get-ParameterValue with a file config | ||
And a settings file named Verb.psd1 in the current folder | ||
""" | ||
@{ | ||
UserName = 'Joel' | ||
Age = 42 | ||
Alias = 'Supports Aliases' | ||
} | ||
""" | ||
When I call Test-Verb -Age 10 | ||
Then the output object's userName should be Joel | ||
And the output object's Age should be 10 | ||
|
||
@Functions @Import | ||
Scenario: New-User Example | ||
Given an example New-User command | ||
And a settings file named User.psd1 in the current folder | ||
""" | ||
@{ | ||
Domain = 'HuddledMasses.org' | ||
} | ||
""" | ||
When I call New-User Joel Bennett | ||
Then the output object's EMail should be Joel.Bennett@HuddledMasses.org | ||
|
||
@Functions @Import | ||
Scenario: New-User Example Two (overwriting) | ||
Given an example New-User command | ||
And a settings file named User.psd1 in the current folder | ||
""" | ||
@{ | ||
Permissions = @{ | ||
Access = "Administrator" | ||
} | ||
} | ||
""" | ||
And a settings file named User.psd1 in the parent folder | ||
""" | ||
@{ | ||
Department = "Security" | ||
Permissions = @{ | ||
Access = "User" | ||
} | ||
} | ||
""" | ||
And a settings file named User.psd1 | ||
""" | ||
@{ | ||
Domain = "HuddledMasses.org" | ||
} | ||
""" | ||
When I call New-User Joel Bennett | ||
Then the output object's EMail should be Joel.Bennett@HuddledMasses.org | ||
And the output object's Department should be Security | ||
And the output object's Permissions should be of type [hashtable] | ||
And the output object's Permissions.Access should be Administrator | ||
|
||
|
||
@Functions @Import | ||
Scenario: New-User Example Three | ||
Given an example New-User command | ||
And a settings file named SecurityUser.psd1 in the current folder | ||
""" | ||
@{ | ||
Domain = 'HuddledMasses.org' | ||
Permissions = @{ | ||
Access = "Administrator" | ||
} | ||
} | ||
""" | ||
When I call New-User Joel Bennett -Department Security | ||
Then the output object's EMail should be Joel.Bennett@HuddledMasses.org | ||
And the output object's Permissions should be of type [hashtable] | ||
And the output object's Permissions.Access should be of type [string] | ||
And the output object's Permissions.Access should be Administrator | ||
And the output object's ExtraParameter should be Supports Aliases |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters