spec/integration/download_spec.rb in knife-essentials-0.8.6 vs spec/integration/download_spec.rb in knife-essentials-0.9.0
- old
+ new
@@ -495,6 +495,33 @@
EOM
knife('diff --name-status /cookbooks').should_succeed ''
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 download succeeds' do
+ knife('download /environments/x.json').should_succeed "Updated /environments/x.json\n", :stderr => "WARN: Parse error reading #{path_to('environments/x.json')} as JSON: A JSON text must at least contain two octets!\n"
+ knife('diff --name-status /environments/x.json').should_succeed ''
+ end
+ end
+
+ when_the_repository 'has the same environment with the wrong name in the file' do
+ file 'environments/x.json', { 'name' => 'y' }
+ it 'knife download succeeds' do
+ knife('download /environments/x.json').should_succeed "Updated /environments/x.json\n"
+ knife('diff --name-status /environments/x.json').should_succeed ''
+ end
+ end
+
+ when_the_repository 'has the same environment with no name in the file' do
+ file 'environments/x.json', { 'description' => 'hi' }
+ it 'knife download succeeds' do
+ knife('download /environments/x.json').should_succeed "Updated /environments/x.json\n"
+ knife('diff --name-status /environments/x.json').should_succeed ''
+ end
+ end
+ end
end