diff options
author | Les Hill and Robert Pitts <dev+leshill+rbxbx@hashrocket.com> | 2010-08-06 23:00:12 +0800 |
---|---|---|
committer | Michael Bleigh <michael@intridea.com> | 2010-08-10 22:57:12 +0800 |
commit | 714dad5ccd277f47d753b258311f0cc5ff961491 (patch) | |
tree | ccb7e308e6f4740fab997f9836306284b81f96bc | |
parent | f3a76923b259be19db0a7ed5a68ed45ac05f00d0 (diff) | |
download | hashie-714dad5ccd277f47d753b258311f0cc5ff961491.tar.gz |
Initializing Dash with a nil
-rw-r--r-- | lib/hashie/dash.rb | 2 | ||||
-rw-r--r-- | spec/hashie/dash_spec.rb | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/hashie/dash.rb b/lib/hashie/dash.rb index 3a149ae..4e15de4 100644 --- a/lib/hashie/dash.rb +++ b/lib/hashie/dash.rb @@ -80,7 +80,7 @@ module Hashie attributes.each_pair do |att, value| self.send("#{att}=", value) - end + end if attributes end # Retrieve a value from the Dash (will return the diff --git a/spec/hashie/dash_spec.rb b/spec/hashie/dash_spec.rb index a3aba1d..db92e4c 100644 --- a/spec/hashie/dash_spec.rb +++ b/spec/hashie/dash_spec.rb @@ -70,6 +70,13 @@ describe Hashie::Dash do DashTest.new(:first_name => 'Michael').first_name.should == 'Michael' end end + + describe 'initializing with a nil' do + it 'accepts nil' do + lambda { DashTest.new(nil) }.should_not raise_error + end + end + describe ' defaults' do before do @dash = DashTest.new |