summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarcy Laycock <sutto@thefrontiergroup.com.au>2011-01-20 14:22:41 +0800
committerDarcy Laycock <sutto@thefrontiergroup.com.au>2011-01-20 14:22:41 +0800
commit4db1a2b72c7fa4a3e1e8764da5c044f04c02aad3 (patch)
treed0bd61c58a94f4ff39b0431a25e86730333239a4
parentef366e25b60955bbbf61b28febafe5c5e95b8cdc (diff)
downloadhashie-4db1a2b72c7fa4a3e1e8764da5c044f04c02aad3.tar.gz
Add add a failing state to the dash spec
-rw-r--r--lib/hashie/dash.rb2
-rw-r--r--spec/hashie/dash_spec.rb6
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