1 #! /usr/bin/env ruby -S rspec
2 require 'spec_helper_acceptance'
4 describe 'pick function' do
6 it 'picks a default value' do
9 $o = pick($a, 'default')
10 notice(inline_template('picked is <%= @o.inspect %>'))
13 apply_manifest(pp, :catch_failures => true) do |r|
14 expect(r.stdout).to match(/picked is "default"/)
17 it 'picks the first set value' do
21 $o = pick($a, $b, 'default')
22 notice(inline_template('picked is <%= @o.inspect %>'))
25 apply_manifest(pp, :catch_failures => true) do |r|
26 expect(r.stdout).to match(/picked is "something"/)
31 it 'raises error with all undef values' do
36 notice(inline_template('picked is <%= @o.inspect %>'))
39 apply_manifest(pp, :expect_failures => true) do |r|
40 expect(r.stderr).to match(/must receive at least one non empty value/)