Initialization of ExtendentDocument model shouldn't failed on a nil value in argument

Signed-off-by: Tapajós <tapajos@gmail.com>
This commit is contained in:
deepj 2009-11-10 03:23:55 +01:00 committed by Tapajós
parent 40bef6cafb
commit b8bda3bb02
2 changed files with 6 additions and 1 deletions

View file

@ -41,7 +41,7 @@ module CouchRest
def initialize(passed_keys={})
apply_defaults # defined in CouchRest::Mixins::Properties
set_attributes(passed_keys)
set_attributes(passed_keys) unless passed_keys.nil?
super
cast_keys # defined in CouchRest::Mixins::Properties
unless self['_id'] && self['_rev']

View file

@ -129,6 +129,11 @@ describe "ExtendedDocument" do
@obj.should be_new_document
@obj.should be_new_record
end
it "should not failed on a nil value in argument" do
@obj = Basic.new(nil)
@obj.should == { 'couchrest-type' => 'Basic' }
end
end
describe "creating a new document" do