diff options
author | Jordan Running <jr@getchef.com> | 2016-03-24 12:01:40 -0500 |
---|---|---|
committer | Jordan Running <jr@getchef.com> | 2016-03-29 10:05:34 -0500 |
commit | 7d505ce8101679e744692b00627ef015dd8a153f (patch) | |
tree | 640d184fb9fc5777b7f610a9c9323e9a26884a2e /spec/unit/application_spec.rb | |
parent | bd272751f4493b4414802490b068dd0196fabf02 (diff) | |
download | chef-7d505ce8101679e744692b00627ef015dd8a153f.tar.gz |
Add shorthand :syslog and :win_evt for log_location configjr/logger-config
Diffstat (limited to 'spec/unit/application_spec.rb')
-rw-r--r-- | spec/unit/application_spec.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/unit/application_spec.rb b/spec/unit/application_spec.rb index 462b7314c4..8ab6e13204 100644 --- a/spec/unit/application_spec.rb +++ b/spec/unit/application_spec.rb @@ -247,6 +247,33 @@ describe Chef::Application do it_behaves_like "log_level_is_auto" end + + describe "log_location" do + shared_examples("sets log_location") do |config_value, expected_class| + context "when the configured value is #{config_value.inspect}" do + let(:logger_instance) { instance_double(expected_class).as_null_object } + + before do + allow(expected_class).to receive(:new).and_return(logger_instance) + Chef::Config[:log_location] = config_value + end + + it "it sets log_location to an instance of #{expected_class}" do + expect(expected_class).to receive(:new).with no_args + @app.configure_logging + expect(Chef::Config[:log_location]).to be logger_instance + end + end + end + + if Chef::Platform.windows? + it_behaves_like "sets log_location", :win_evt, Chef::Log::WinEvt + it_behaves_like "sets log_location", "win_evt", Chef::Log::WinEvt + else + it_behaves_like "sets log_location", :syslog, Chef::Log::Syslog + it_behaves_like "sets log_location", "syslog", Chef::Log::Syslog + end + end end end |