X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;ds=sidebyside;f=3rdparty%2Fmodules%2Fstdlib%2Fspec%2Facceptance%2Fparseyaml_spec.rb;fp=3rdparty%2Fmodules%2Fstdlib%2Fspec%2Facceptance%2Fparseyaml_spec.rb;h=5819837cfa1aaab11a66c4a42ab7e080d777b473;hb=ad88f67c13ae0f1a08936dad643f1e3509ab5f40;hp=0000000000000000000000000000000000000000;hpb=23d29143ac40015ce61cf83a4067466f8f7d66dc;p=dsa-puppet.git diff --git a/3rdparty/modules/stdlib/spec/acceptance/parseyaml_spec.rb b/3rdparty/modules/stdlib/spec/acceptance/parseyaml_spec.rb new file mode 100755 index 00000000..5819837c --- /dev/null +++ b/3rdparty/modules/stdlib/spec/acceptance/parseyaml_spec.rb @@ -0,0 +1,35 @@ +#! /usr/bin/env ruby -S rspec +require 'spec_helper_acceptance' + +describe 'parseyaml function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'parses valid yaml' do + pp = <<-EOS + $a = "---\nhunter: washere\ntests: passing\n" + $o = parseyaml($a) + $tests = $o['tests'] + notice(inline_template('tests are <%= @tests.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/tests are "passing"/) + end + end + end + describe 'failure' do + it 'raises error on incorrect yaml' do + pp = <<-EOS + $a = "---\nhunter: washere\ntests: passing\n:" + $o = parseyaml($a) + $tests = $o['tests'] + notice(inline_template('tests are <%= @tests.inspect %>')) + EOS + + apply_manifest(pp, :expect_failures => true) do |r| + expect(r.stderr).to match(/(syntax error|did not find expected key)/) + end + end + + it 'raises error on incorrect number of arguments' + end +end