summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Keiser <jkeiser@opscode.com>2013-09-16 21:20:05 -0700
committerJohn Keiser <jkeiser@opscode.com>2013-09-16 21:20:05 -0700
commita42bbadd953c47c4819a08f48cbce18a47e9f207 (patch)
tree2373b6fa229c1a0f8318a0875d6e8ae1f35e571f
parent62767f18c0690dffb1147ebc67793989b7e5fe3c (diff)
downloadchef-a42bbadd953c47c4819a08f48cbce18a47e9f207.tar.gz
Make formatters clear with Chef::Config.reset
-rw-r--r--lib/chef/config.rb4
-rw-r--r--spec/unit/config_spec.rb18
2 files changed, 6 insertions, 16 deletions
diff --git a/lib/chef/config.rb b/lib/chef/config.rb
index bc496a5924..957645ba79 100644
--- a/lib/chef/config.rb
+++ b/lib/chef/config.rb
@@ -75,9 +75,7 @@ class Chef
formatters << [name, file_path]
end
- def self.formatters
- @formatters ||= []
- end
+ default :formatters, []
# Override the config dispatch to set the value of multiple server options simultaneously
#
diff --git a/spec/unit/config_spec.rb b/spec/unit/config_spec.rb
index c13b3e378f..b4052f4908 100644
--- a/spec/unit/config_spec.rb
+++ b/spec/unit/config_spec.rb
@@ -25,10 +25,6 @@ describe Chef::Config do
@original_env = { 'HOME' => ENV['HOME'], 'SYSTEMDRIVE' => ENV['SYSTEMDRIVE'], 'HOMEPATH' => ENV['HOMEPATH'], 'USERPROFILE' => ENV['USERPROFILE'] }
end
- before :each do
- Chef::Config.reset
- end
-
describe "config attribute writer: chef_server_url" do
before do
Chef::Config.chef_server_url = "https://junglist.gen.nz"
@@ -85,22 +81,18 @@ describe Chef::Config do
# log_level = info or defualt
# end
#
- before do
- @config_class = Class.new(Chef::Config)
- end
-
it "has an empty list of formatters by default" do
- @config_class.formatters.should == []
+ Chef::Config.formatters.should == []
end
it "configures a formatter with a short name" do
- @config_class.add_formatter(:doc)
- @config_class.formatters.should == [[:doc, nil]]
+ Chef::Config.add_formatter(:doc)
+ Chef::Config.formatters.should == [[:doc, nil]]
end
it "configures a formatter with a file output" do
- @config_class.add_formatter(:doc, "/var/log/formatter.log")
- @config_class.formatters.should == [[:doc, "/var/log/formatter.log"]]
+ Chef::Config.add_formatter(:doc, "/var/log/formatter.log")
+ Chef::Config.formatters.should == [[:doc, "/var/log/formatter.log"]]
end
end