-
Notifications
You must be signed in to change notification settings - Fork 900
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15513 from djberg96/validate_blacklist
Add validate_blacklist method for VM pre-provisioning
- Loading branch information
Showing
2 changed files
with
24 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -358,6 +358,22 @@ | |
end | ||
end | ||
|
||
context "#validate_blacklist" do | ||
let(:blacklist) { {:blacklist => ['foo', 'bar']} } | ||
|
||
it "returns nil if the value is not blacklisted" do | ||
expect(workflow.validate_blacklist(nil, {}, {}, blacklist, 'test')).to be_nil | ||
end | ||
|
||
it "returns a formatted message when the value is blacklisted" do | ||
expect(workflow.validate_blacklist(nil, {}, {}, blacklist, 'foo')).to eq("'/' may not contain blacklisted value") | ||
end | ||
|
||
it "returns an error when no value exists" do | ||
expect(workflow.validate_blacklist(nil, {}, {}, blacklist, '')).to eq "'/' is required" | ||
end | ||
end | ||
|
||
context "#validate regex" do | ||
let(:regex) { {:required_regex => "^[email protected]$"} } | ||
let(:regex_two) { {:required_regex => "^n$"} } | ||
|