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:
parent
40bef6cafb
commit
b8bda3bb02
|
@ -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']
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue