1 require 'spec_helper_acceptance'
3 describe 'try_get_value function' do
7 'a' => { 'b' => 'passing'}
10 $tests = try_get_value($data, 'a/b')
11 notice(inline_template('tests are <%= @tests.inspect %>'))
14 apply_manifest(pp1, :catch_failures => true) do |r|
15 expect(r.stdout).to match(%r{tests are "passing"})
23 'a' => { 'b' => 'passing'}
26 $tests = try_get_value($data, 'c/d', 'using the default value')
27 notice(inline_template('tests are <%= @tests.inspect %>'))
29 it 'uses a default value' do
30 apply_manifest(pp2, :catch_failures => true) do |r|
31 expect(r.stdout).to match(%r{using the default value})
38 it 'raises error on incorrect number of arguments' do
39 apply_manifest(pp, :expect_failures => true) do |r|
40 expect(r.stderr).to match(%r{wrong number of arguments}i)