diff options
author | John Keiser <jkeiser@opscode.com> | 2013-09-16 15:28:30 -0700 |
---|---|---|
committer | John Keiser <jkeiser@opscode.com> | 2013-09-16 15:28:30 -0700 |
commit | fbad43e6b6451c7e4e530b4cf3ff5f6b0e22a0a7 (patch) | |
tree | 798d377b41dfb6d3564938800cd3027fb9b1ff00 | |
parent | c6436a1bfe494883bfb1af46af0a0f175e204c72 (diff) | |
download | mixlib-config-fbad43e6b6451c7e4e530b4cf3ff5f6b0e22a0a7.tar.gz |
Fix issue with Config['a'] = b
-rw-r--r-- | lib/mixlib/config.rb | 2 | ||||
-rw-r--r-- | spec/mixlib/config_spec.rb | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/lib/mixlib/config.rb b/lib/mixlib/config.rb index 4a1a094..db86d6b 100644 --- a/lib/mixlib/config.rb +++ b/lib/mixlib/config.rb @@ -79,7 +79,7 @@ module Mixlib # === Raises # <UnknownConfigOptionError>:: If the config option does not exist and strict mode is on. def []=(config_option, value) - internal_set(config_option, value) + internal_set(config_option.to_sym, value) end # Check if Mixlib::Config has a config option. diff --git a/spec/mixlib/config_spec.rb b/spec/mixlib/config_spec.rb index ec6ece5..7f4ba48 100644 --- a/spec/mixlib/config_spec.rb +++ b/spec/mixlib/config_spec.rb @@ -63,11 +63,20 @@ describe Mixlib::Config do ConfigIt[:alpha].should == 'omega' end + it "should allow you to reference a value by string index" do + ConfigIt['alpha'].should == 'omega' + end + it "should allow you to set a value by index" do ConfigIt[:alpha] = "one" ConfigIt[:alpha].should == "one" end + it "should allow you to set a value by string index" do + ConfigIt['alpha'] = "one" + ConfigIt[:alpha].should == "one" + end + it "should allow setting a value with attribute form" do ConfigIt.arbitrary_value = 50 ConfigIt.arbitrary_value.should == 50 |