summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Mundrawala <jdmundrawala@gmail.com>2016-02-12 10:57:33 -0800
committerJay Mundrawala <jdmundrawala@gmail.com>2016-02-24 21:24:14 -0800
commit571ad244852b9cd1998af6d67860ff1de5d5e051 (patch)
treef94fea102974d915ff0c6a7da7ecfd4f53b06d6e
parent352c98ee1f50cf3d18f341e48b5fe3214e5afda5 (diff)
downloadchef-571ad244852b9cd1998af6d67860ff1de5d5e051.tar.gz
Fix broken load_conf_d_file
Also, do less mocking so the test will catch the error
-rw-r--r--lib/chef/application/client.rb4
-rw-r--r--spec/unit/application/client_spec.rb7
2 files changed, 7 insertions, 4 deletions
diff --git a/lib/chef/application/client.rb b/lib/chef/application/client.rb
index c9a381a045..7de6bb05c2 100644
--- a/lib/chef/application/client.rb
+++ b/lib/chef/application/client.rb
@@ -518,9 +518,9 @@ class Chef::Application::Client < Chef::Application
end
def load_config_d_file(f)
- config_fetcher = Chef::ConfigFetcher.new(conf)
+ config_fetcher = Chef::ConfigFetcher.new(f)
config_fetcher.read_local_config.tap do |config_content|
- apply_config(config_content, conf)
+ apply_config(config_content, f)
end
end
diff --git a/spec/unit/application/client_spec.rb b/spec/unit/application/client_spec.rb
index 7476e1dc73..0bf23a8b54 100644
--- a/spec/unit/application/client_spec.rb
+++ b/spec/unit/application/client_spec.rb
@@ -278,8 +278,11 @@ Enable chef-client interval runs by setting `:client_fork = true` in your config
File.join(File.dirname(__FILE__), "../../data/client.d_00")) }
it "loads the configuration in order" do
- expect(app).to receive(:load_config_d_file).with("#{client_d_dir}/00-foo.rb").ordered
- expect(app).to receive(:load_config_d_file).with("#{client_d_dir}/01-bar.rb").ordered
+
+ expect(::File).to receive(:read).with(Chef::Config.platform_specific_path("#{client_d_dir}/00-foo.rb")).and_return("")
+ expect(::File).to receive(:read).with(Chef::Config.platform_specific_path("#{client_d_dir}/01-bar.rb")).and_return("")
+ expect(app).to receive(:load_config_d_file).with("#{client_d_dir}/00-foo.rb").and_call_original.ordered
+ expect(app).to receive(:load_config_d_file).with("#{client_d_dir}/01-bar.rb").and_call_original.ordered
app.reconfigure
end
end