diff options
author | James Casey <james@opscode.com> | 2014-02-07 21:23:57 -0800 |
---|---|---|
committer | James Casey <james@opscode.com> | 2014-02-07 21:23:57 -0800 |
commit | a5dde10383dfa344500ac5e41880ce95dee75507 (patch) | |
tree | 5e65ca646d83b0c2718aa5b768881e8bb01c0025 | |
parent | 379d177da06b6886ac5bfe677e5ebb2e039c2e2c (diff) | |
download | chef-a5dde10383dfa344500ac5e41880ce95dee75507.tar.gz |
Add default value for event_handler to Chef::Config
This is a back-port of CHEF-4363
-rw-r--r-- | chef/lib/chef/config.rb | 3 | ||||
-rw-r--r-- | chef/spec/unit/config_spec.rb | 15 |
2 files changed, 16 insertions, 2 deletions
diff --git a/chef/lib/chef/config.rb b/chef/lib/chef/config.rb index 51160d8cac..cbd4da7fde 100644 --- a/chef/lib/chef/config.rb +++ b/chef/lib/chef/config.rb @@ -293,6 +293,9 @@ class Chef # Report Handlers report_handlers [] + # Event Handlers + event_handlers [] + # Exception Handlers exception_handlers [] diff --git a/chef/spec/unit/config_spec.rb b/chef/spec/unit/config_spec.rb index f26b7a39eb..7e1b6c228d 100644 --- a/chef/spec/unit/config_spec.rb +++ b/chef/spec/unit/config_spec.rb @@ -50,7 +50,7 @@ describe Chef::Config do before do Chef::Config.chef_server_url = "https://junglist.gen.nz" end - + it_behaves_like "server URL" end @@ -58,7 +58,7 @@ describe Chef::Config do before do Chef::Config.chef_server_url = " https://junglist.gen.nz" end - + it_behaves_like "server URL" end @@ -217,6 +217,17 @@ describe Chef::Config do end end + describe "Chef::Config[:event_handlers]" do + it "sets a event_handlers to an empty array by default" do + Chef::Config[:event_handlers].should eq([]) + end + it "should be able to add custom handlers" do + o = Object.new + Chef::Config[:event_handlers] << o + Chef::Config[:event_handlers].should be_include(o) + end + end + after(:each) do Chef::Config.configuration = @original_config end |