From c50262a4f63e0f81a16926d4544905d0764c8fc6 Mon Sep 17 00:00:00 2001 From: jkeiser Date: Sat, 19 Jan 2013 14:52:27 -0800 Subject: Protect against bad JSON on the client --- spec/integration/knife/diff_spec.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'spec/integration/knife') diff --git a/spec/integration/knife/diff_spec.rb b/spec/integration/knife/diff_spec.rb index 921a43ead2..60c4a24731 100644 --- a/spec/integration/knife/diff_spec.rb +++ b/spec/integration/knife/diff_spec.rb @@ -278,4 +278,14 @@ EOM end end end + + when_the_chef_server 'has an environment' do + environment 'x', {} + when_the_repository 'has an environment with bad JSON' do + file 'environments/x.json', '{' + it 'knife diff reports a warning and does a textual diff' do + knife('diff /environments/x.json').should_succeed(/- "name": "x"/, :stderr => "WARN: Parse error reading #{path_to('environments/x.json')} as JSON: A JSON text must at least contain two octets!\n") + end + end + end end -- cgit v1.2.1