summaryrefslogtreecommitdiff
path: root/spec/functions
diff options
context:
space:
mode:
authorHunter Haugen <hunter@puppetlabs.com>2016-02-16 12:26:51 -0800
committerHunter Haugen <hunter@puppetlabs.com>2016-02-16 12:26:51 -0800
commite2206fd1530bbcad7afcb430bfb4f97d797529d9 (patch)
treebe1ca6a0a2e42f9855ca64b3eddcfc8f4c4f8c48 /spec/functions
parentc83a70e6741b36ab33c787c7898bbaf7f336a7f4 (diff)
parent3169a43f4c24d01c64c90ab9537da284f587c726 (diff)
Merge pull request #573 from Yelp/pl-dig
Add dig function
Diffstat (limited to 'spec/functions')
-rw-r--r--spec/functions/dig_spec.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/functions/dig_spec.rb b/spec/functions/dig_spec.rb
new file mode 100644
index 0000000..1c5d49d
--- /dev/null
+++ b/spec/functions/dig_spec.rb
@@ -0,0 +1,13 @@
+require 'spec_helper'
+
+describe 'dig' do
+ it { is_expected.to run.with_params().and_raise_error(Puppet::ParseError) }
+ it { is_expected.to run.with_params('bad', []).and_raise_error(Puppet::ParseError) }
+ it { is_expected.to run.with_params({}, 'bad').and_raise_error(Puppet::ParseError) }
+
+ it { is_expected.to run.with_params({}, []).and_return({}) }
+ it { is_expected.to run.with_params({"a" => "b"}, ["a"]).and_return("b") }
+ it { is_expected.to run.with_params({"a" => {"b" => "c"}}, ["a", "b"]).and_return("c") }
+ it { is_expected.to run.with_params({}, ["a", "b"], "d").and_return("d") }
+ it { is_expected.to run.with_params({"a" => false}, ["a"]).and_return(false) }
+end