summaryrefslogtreecommitdiff
path: root/spec/acceptance/parsejson_spec.rb
diff options
context:
space:
mode:
authorMorgan Haskel <morgan@puppetlabs.com>2015-09-21 10:56:08 -0700
committerMorgan Haskel <morgan@puppetlabs.com>2015-09-21 11:11:21 -0700
commit799c38e14e1583e676e2b25a9c1782fd40e29fff (patch)
treeca2f93dd6d459eac114f1e0b5cac05ac02d519cd /spec/acceptance/parsejson_spec.rb
parent9b1932c538354c1b360838c8cf7b942af314c99d (diff)
Fix backwards compatibility from #511
Maintain the old behavior in the case where the optional second parameter isn't passed. Also, adding arity is backwards incompatible since stdlib still supports 2.7, so remove that.
Diffstat (limited to 'spec/acceptance/parsejson_spec.rb')
-rwxr-xr-xspec/acceptance/parsejson_spec.rb16
1 files changed, 14 insertions, 2 deletions
diff --git a/spec/acceptance/parsejson_spec.rb b/spec/acceptance/parsejson_spec.rb
index d0feabd..d0e3de8 100755
--- a/spec/acceptance/parsejson_spec.rb
+++ b/spec/acceptance/parsejson_spec.rb
@@ -21,12 +21,24 @@ describe 'parsejson function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('o
it 'raises error on incorrect json' do
pp = <<-EOS
$a = '{"hunter": "washere", "tests": "passing",}'
- $ao = parsejson($a, {'tests' => 'using the default value'})
+ $ao = parsejson($a, 'tests are using the default value')
notice(inline_template('a is <%= @ao.inspect %>'))
EOS
apply_manifest(pp, :catch_failures => true) do |r|
- expect(r.stdout).to match(/tests are "using the default value"/)
+ expect(r.stdout).to match(/tests are using the default value/)
+ end
+ end
+
+ it 'raises error on incorrect json' do
+ pp = <<-EOS
+ $a = '{"hunter": "washere", "tests": "passing",}'
+ $ao = parsejson($a)
+ notice(inline_template('a is <%= @ao.inspect %>'))
+ EOS
+
+ apply_manifest(pp, :expect_failures => true) do |r|
+ expect(r.stderr).to match(/expected next name/)
end
end