diff options
author | Josh Murphy <josh.murphy@cerner.com> | 2014-11-18 07:41:27 -0600 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2015-01-25 11:03:39 -0800 |
commit | d9092ef8ed9e79f5ca43604083b9a6aab1d3b889 (patch) | |
tree | 28af00e1e89e711b8af19e78e0fd5fc4a00f1594 | |
parent | df0e30c5d2b82d6b1a45f13cbc9735bd670f35d3 (diff) | |
download | chef-d9092ef8ed9e79f5ca43604083b9a6aab1d3b889.tar.gz |
Added cookbook_path configuration value to warning message for uploading cookbooks and updated tests
-rw-r--r-- | lib/chef/knife/cookbook_upload.rb | 3 | ||||
-rw-r--r-- | spec/unit/knife/cookbook_upload_spec.rb | 19 |
2 files changed, 18 insertions, 4 deletions
diff --git a/lib/chef/knife/cookbook_upload.rb b/lib/chef/knife/cookbook_upload.rb index 0c18618ea4..928f9491fd 100644 --- a/lib/chef/knife/cookbook_upload.rb +++ b/lib/chef/knife/cookbook_upload.rb @@ -118,7 +118,8 @@ class Chef end ui.info("Uploaded all cookbooks.") else - ui.warn('Could not find any cookbooks in your cookbook path. Use --cookbook-path to specify the desired path.') + cookbook_path = config[:cookbook_path].respond_to?(:join) ? config[:cookbook_path].join(', ') : config[:cookbook_path] + ui.warn("Could not find any cookbooks in your cookbook path: #{cookbook_path}. Use --cookbook-path to specify the desired path.") end else if @name_args.empty? diff --git a/spec/unit/knife/cookbook_upload_spec.rb b/spec/unit/knife/cookbook_upload_spec.rb index 3e6381083c..fb94886cad 100644 --- a/spec/unit/knife/cookbook_upload_spec.rb +++ b/spec/unit/knife/cookbook_upload_spec.rb @@ -285,9 +285,22 @@ E knife.run end - it 'should warn users that no cookbooks exist' do - expect(knife.ui).to receive(:warn).with(/Could not find any cookbooks in your cookbook path\. Use --cookbook-path to specify the desired path\./) - knife.run + context 'when cookbook path is an array' do + it 'should warn users that no cookbooks exist' do + knife.config[:cookbook_path] = ['/chef-repo/cookbooks', '/home/user/cookbooks'] + expect(knife.ui).to receive(:warn).with( + /Could not find any cookbooks in your cookbook path: #{knife.config[:cookbook_path].join(', ')}\. Use --cookbook-path to specify the desired path\./) + knife.run + end + end + + context 'when cookbook path is a string' do + it 'should warn users that no cookbooks exist' do + knife.config[:cookbook_path] = '/chef-repo/cookbooks' + expect(knife.ui).to receive(:warn).with( + /Could not find any cookbooks in your cookbook path: #{knife.config[:cookbook_path]}\. Use --cookbook-path to specify the desired path\./) + knife.run + end end end end |