1 require 'spec_helper_acceptance'
3 describe 'pick function' do
7 $o = pick($a, 'default')
8 notice(inline_template('picked is <%= @o.inspect %>'))
10 it 'picks a default value' do
11 apply_manifest(pp1, :catch_failures => true) do |r|
12 expect(r.stdout).to match(%r{picked is "default"})
19 $o = pick($a, $b, 'default')
20 notice(inline_template('picked is <%= @o.inspect %>'))
22 it 'picks the first set value' do
23 apply_manifest(pp2, :catch_failures => true) do |r|
24 expect(r.stdout).to match(%r{picked is "something"})
34 notice(inline_template('picked is <%= @o.inspect %>'))
36 it 'raises error with all undef values' do
37 apply_manifest(pp3, :expect_failures => true) do |r|
38 expect(r.stderr).to match(%r{must receive at least one non empty value})