summaryrefslogtreecommitdiff
path: root/spec/functions/member_spec.rb
diff options
context:
space:
mode:
authorYanis Guenane <yguenane@gmail.com>2014-09-15 14:16:52 -0400
committerYanis Guenane <yanis.guenane@enovance.com>2014-11-12 14:40:34 -0500
commitc9f906f80325a12a6509633d87472bd3cbaf0364 (patch)
treeeca4dba4d953c381a2fd3c66eb9916de64b13dd4 /spec/functions/member_spec.rb
parent85d7eddc41b04c9a9a7bf1a171dd8d3ab157a88a (diff)
downloadpuppet-stdlib-c9f906f80325a12a6509633d87472bd3cbaf0364.tar.gz
puppet-stdlib-c9f906f80325a12a6509633d87472bd3cbaf0364.tar.bz2
(MODULES-1329) Allow member function to look for array
Currently, the member function allows one to only find if a variable is part of an array. Sometimes it is useful to find if an array is part of a bigger array for validation purpose.
Diffstat (limited to 'spec/functions/member_spec.rb')
-rwxr-xr-xspec/functions/member_spec.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/functions/member_spec.rb b/spec/functions/member_spec.rb
index cee6110..1a1d7c6 100755
--- a/spec/functions/member_spec.rb
+++ b/spec/functions/member_spec.rb
@@ -21,4 +21,14 @@ describe "the member function" do
result = scope.function_member([["a","b","c"], "d"])
expect(result).to(eq(false))
end
+
+ it "should return true if a member array is in an array" do
+ result = scope.function_member([["a","b","c"], ["a", "b"]])
+ expect(result).to(eq(true))
+ end
+
+ it "should return false if a member array is not in an array" do
+ result = scope.function_member([["a","b","c"], ["d", "e"]])
+ expect(result).to(eq(false))
+ end
end