]> git.donarmstrong.com Git - dsa-puppet.git/blob - 3rdparty/modules/stdlib/spec/acceptance/parseyaml_spec.rb
upgrade to stdlib 4.6.1
[dsa-puppet.git] / 3rdparty / modules / stdlib / spec / acceptance / parseyaml_spec.rb
1 #! /usr/bin/env ruby -S rspec
2 require 'spec_helper_acceptance'
3
4 describe 'parseyaml function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
5   describe 'success' do
6     it 'parses valid yaml' do
7       pp = <<-EOS
8       $a = "---\nhunter: washere\ntests: passing\n"
9       $o = parseyaml($a)
10       $tests = $o['tests']
11       notice(inline_template('tests are <%= @tests.inspect %>'))
12       EOS
13
14       apply_manifest(pp, :catch_failures => true) do |r|
15         expect(r.stdout).to match(/tests are "passing"/)
16       end
17     end
18   end
19   describe 'failure' do
20     it 'raises error on incorrect yaml' do
21       pp = <<-EOS
22       $a = "---\nhunter: washere\ntests: passing\n:"
23       $o = parseyaml($a)
24       $tests = $o['tests']
25       notice(inline_template('tests are <%= @tests.inspect %>'))
26       EOS
27
28       apply_manifest(pp, :expect_failures => true) do |r|
29         expect(r.stderr).to match(/(syntax error|did not find expected key)/)
30       end
31     end
32
33     it 'raises error on incorrect number of arguments'
34   end
35 end