summaryrefslogtreecommitdiff
path: root/spec/acceptance/parseyaml_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/acceptance/parseyaml_spec.rb')
-rwxr-xr-xspec/acceptance/parseyaml_spec.rb25
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