1 require 'spec_helper_acceptance'
3 describe 'parseyaml function' do
6 $a = "---\nhunter: washere\ntests: passing\n"
9 notice(inline_template('tests are <%= @tests.inspect %>'))
11 it 'parses valid yaml' do
12 apply_manifest(pp1, :catch_failures => true) do |r|
13 expect(r.stdout).to match(%r{tests are "passing"})
20 $a = "---\nhunter: washere\ntests: passing\n:"
21 $o = parseyaml($a, {'tests' => 'using the default value'})
23 notice(inline_template('tests are <%= @tests.inspect %>'))
25 it 'returns the default value on incorrect yaml' do
26 apply_manifest(pp2, :catch_failures => true) do |r|
27 expect(r.stdout).to match(%r{tests are "using the default value"})
32 $a = "---\nhunter: washere\ntests: passing\n:"
35 notice(inline_template('tests are <%= @tests.inspect %>'))
37 it 'raises error on incorrect yaml' do
38 apply_manifest(pp3, :expect_failures => true) do |r|
39 expect(r.stderr).to match(%r{(syntax error|did not find expected key)})
46 it 'raises error on incorrect number of arguments' do
47 apply_manifest(pp4, :expect_failures => true) do |r|
48 expect(r.stderr).to match(%r{wrong number of arguments}i)