1 require 'spec_helper_acceptance'
3 describe 'pick_default function' do
7 $o = pick_default($a, 'default')
8 notice(inline_template('picked is <%= @o.inspect %>'))
10 it 'pick_defaults 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_default($a,$b)
20 notice(inline_template('picked is <%= @o.inspect %>'))
22 it 'pick_defaults with no value' do
23 apply_manifest(pp2, :catch_failures => true) do |r|
24 expect(r.stdout).to match(%r{picked is ""})
31 $o = pick_default($a, $b, 'default')
32 notice(inline_template('picked is <%= @o.inspect %>'))
34 it 'pick_defaults the first set value' do
35 apply_manifest(pp3, :catch_failures => true) do |r|
36 expect(r.stdout).to match(%r{picked is "something"})
43 notice(inline_template('picked is <%= @o.inspect %>'))
45 it 'raises error with no values' do
46 apply_manifest(pp4, :expect_failures => true) do |r|
47 expect(r.stderr).to match(%r{Must receive at least one argument})