diff options
author | varac <varacanero@zeromail.org> | 2017-01-13 12:41:58 +0100 |
---|---|---|
committer | varac <varacanero@zeromail.org> | 2017-01-13 12:41:58 +0100 |
commit | 066c08f8362d53f0f30897cb8710d11260c726ea (patch) | |
tree | a6369eecd88bb731fe413d0bbc8af73d74d1f447 /spec/acceptance/parseyaml_spec.rb | |
parent | 71123634744b9fe2ec7d6a3e38e9789fd84801e3 (diff) | |
parent | b65dd1f45d10e10e45455358aeabb29167990e2c (diff) |
Merge remote-tracking branch 'origin/master' into leap_master
Diffstat (limited to 'spec/acceptance/parseyaml_spec.rb')
-rwxr-xr-x | spec/acceptance/parseyaml_spec.rb | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/spec/acceptance/parseyaml_spec.rb b/spec/acceptance/parseyaml_spec.rb index 5819837..64511f1 100755 --- a/spec/acceptance/parseyaml_spec.rb +++ b/spec/acceptance/parseyaml_spec.rb @@ -16,7 +16,21 @@ describe 'parseyaml function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('o end end end + describe 'failure' do + it 'returns the default value on incorrect yaml' do + pp = <<-EOS + $a = "---\nhunter: washere\ntests: passing\n:" + $o = parseyaml($a, {'tests' => 'using the default value'}) + $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 "using the default value"/) + end + end + it 'raises error on incorrect yaml' do pp = <<-EOS $a = "---\nhunter: washere\ntests: passing\n:" @@ -30,6 +44,15 @@ describe 'parseyaml function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('o end end - it 'raises error on incorrect number of arguments' + + it 'raises error on incorrect number of arguments' do + pp = <<-EOS + $o = parseyaml() + EOS + + apply_manifest(pp, :expect_failures => true) do |r| + expect(r.stderr).to match(/wrong number of arguments/i) + end + end end end |