summaryrefslogtreecommitdiff
path: root/spec/unit/knife_spec.rb
diff options
context:
space:
mode:
authordanielsdeleo <dan@getchef.com>2015-05-20 17:12:04 -0700
committerdanielsdeleo <dan@getchef.com>2015-05-20 17:12:04 -0700
commita151519eddd94303afc1f4cda4ca3f0ff0bee54b (patch)
tree2293b06373a51edf20c03b23f41d17a13ea43cca /spec/unit/knife_spec.rb
parente470d561f9338cc99e7c7e6372e03a53f21dd232 (diff)
downloadchef-a151519eddd94303afc1f4cda4ca3f0ff0bee54b.tar.gz
Stub config loading that was breaking tests on my box
Diffstat (limited to 'spec/unit/knife_spec.rb')
-rw-r--r--spec/unit/knife_spec.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/unit/knife_spec.rb b/spec/unit/knife_spec.rb
index 7aab16ce99..3e8a43eaf5 100644
--- a/spec/unit/knife_spec.rb
+++ b/spec/unit/knife_spec.rb
@@ -30,11 +30,20 @@ describe Chef::Knife do
let(:knife) { Chef::Knife.new }
+ let(:config_location) { File.expand_path("~/.chef/config.rb") }
+
+ let(:config_loader) do
+ instance_double("WorkstationConfigLoader", load: nil, no_config_found?: false, config_location: config_location)
+ end
+
before(:each) do
Chef::Log.logger = Logger.new(StringIO.new)
Chef::Config[:node_name] = "webmonkey.example.com"
+ allow(Chef::WorkstationConfigLoader).to receive(:new).and_return(config_loader)
+ allow(config_loader).to receive(:explicit_config_file=)
+
# Prevent gratuitous code reloading:
allow(Chef::Knife).to receive(:load_commands)
allow(knife.ui).to receive(:puts)