summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-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