summaryrefslogtreecommitdiff
path: root/spec/mixlib
diff options
context:
space:
mode:
authorChristopher Brown <cb@opscode.com>2009-08-24 15:14:13 -0700
committerChristopher Brown <cb@opscode.com>2009-08-24 15:14:13 -0700
commit8970135a7225a7ee8508d73978c4e44d3c7c953d (patch)
treeca7d6087135bdca0453e05e3a9c010cd25fbedc1 /spec/mixlib
parent535d7c04b71f59826e719e5a9b37a9425fe9ba76 (diff)
downloadmixlib-config-internal_set_fix.tar.gz
added config_attr_writerinternal_set_fix
Diffstat (limited to 'spec/mixlib')
-rw-r--r--spec/mixlib/config_spec.rb14
1 files changed, 11 insertions, 3 deletions
diff --git a/spec/mixlib/config_spec.rb b/spec/mixlib/config_spec.rb
index 1566beb..7dce8f4 100644
--- a/spec/mixlib/config_spec.rb
+++ b/spec/mixlib/config_spec.rb
@@ -62,6 +62,12 @@ describe Mixlib::Config 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
+ ConfigIt[:arbitrary_value].should == 50
+ end
describe "when a block has been used to set config values" do
before do
@@ -91,12 +97,14 @@ describe Mixlib::Config do
describe "when a class method override accessor exists" do
before do
class ConfigIt
- def self.test_method=(blah)
- configure { |c| c[:test_method] = blah.is_a?(Integer) ? blah * 1000 : blah }
+
+ config_attr_writer :test_method do |blah|
+ blah.is_a?(Integer) ? blah * 1000 : blah
end
+
end
end
-
+
it "should multiply an integer by 1000" do
ConfigIt[:test_method] = 53
ConfigIt[:test_method].should == 53000