diff options
author | Darcy Laycock <sutto@thefrontiergroup.com.au> | 2011-01-20 14:22:41 +0800 |
---|---|---|
committer | Darcy Laycock <sutto@thefrontiergroup.com.au> | 2011-01-20 14:22:41 +0800 |
commit | 4db1a2b72c7fa4a3e1e8764da5c044f04c02aad3 (patch) | |
tree | d0bd61c58a94f4ff39b0431a25e86730333239a4 | |
parent | ef366e25b60955bbbf61b28febafe5c5e95b8cdc (diff) | |
download | hashie-4db1a2b72c7fa4a3e1e8764da5c044f04c02aad3.tar.gz |
Add add a failing state to the dash spec
-rw-r--r-- | lib/hashie/dash.rb | 2 | ||||
-rw-r--r-- | spec/hashie/dash_spec.rb | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/hashie/dash.rb b/lib/hashie/dash.rb index 9932ad0..861c4ad 100644 --- a/lib/hashie/dash.rb +++ b/lib/hashie/dash.rb @@ -74,7 +74,7 @@ module Hashie super(&block) self.class.defaults.each_pair do |prop, value| - self.send("#{prop}=", value) + self[prop] = value end attributes.each_pair do |att, value| diff --git a/spec/hashie/dash_spec.rb b/spec/hashie/dash_spec.rb index 577bd65..f7412e6 100644 --- a/spec/hashie/dash_spec.rb +++ b/spec/hashie/dash_spec.rb @@ -134,6 +134,12 @@ describe Hashie::Dash, 'inheritance' do @bottom.properties.to_a.should == [:echo] @bottom.new.echo.should be_nil end + + it 'should allow nil defaults' do + @bottom.property :echo, :default => nil + @bottom.new.should have_key('echo') + end + end describe Subclassed do |