summaryrefslogtreecommitdiff
path: root/spec/unit/knife_spec.rb
diff options
context:
space:
mode:
authorAlex Pop <al3xpop@gmail.com>2014-10-04 16:28:15 -0700
committerAlex Pop <al3xpop@gmail.com>2014-10-04 16:28:15 -0700
commit0f4e1a57d4b65d35355a8c3d574b23dbb414e9e9 (patch)
tree7a807a0e041859ef9e169adddd5d5af8079411a0 /spec/unit/knife_spec.rb
parent2fa97c49f25e16c88373e2d084d8bacd46679bd9 (diff)
downloadchef-0f4e1a57d4b65d35355a8c3d574b23dbb414e9e9.tar.gz
print the path to the configuration file used
Diffstat (limited to 'spec/unit/knife_spec.rb')
-rw-r--r--spec/unit/knife_spec.rb19
1 files changed, 18 insertions, 1 deletions
diff --git a/spec/unit/knife_spec.rb b/spec/unit/knife_spec.rb
index 2db6b40b28..6d4763e087 100644
--- a/spec/unit/knife_spec.rb
+++ b/spec/unit/knife_spec.rb
@@ -260,8 +260,25 @@ describe Chef::Knife do
knife_command.configure_chef
knife_command.config[:opt_with_default].should == "from-cli"
end
- end
+ context "verbosity is greater than zero" do
+ let(:fake_config) { "/does/not/exist/knife.rb" }
+
+ before do
+ @knife.config[:verbosity] = 1
+ @knife.config[:config_file] = fake_config
+ config_loader = double("Chef::WorkstationConfigLoader", :load => true, :no_config_found? => false, :chef_config_dir => "/etc/chef", :config_location => fake_config)
+ allow(Chef::WorkstationConfigLoader).to receive(:new).and_return(config_loader)
+ end
+
+ it "prints the path to the configuration file used" do
+ @stdout, @stderr, @stdin = StringIO.new, StringIO.new, StringIO.new
+ @knife.ui = Chef::Knife::UI.new(@stdout, @stderr, @stdin, {})
+ expect(Chef::Log).to receive(:info).with("Using configuration from #{fake_config}")
+ @knife.configure_chef
+ end
+ end
+ end
end
describe "when first created" do