Skip to content

Commit

Permalink
Initialization of ExtendentDocument model shouldn't failed on a nil v…
Browse files Browse the repository at this point in the history
…alue in argument

Signed-off-by: Tapajós <tapajos@gmail.com>
  • Loading branch information
deepj authored and tapajos committed Nov 10, 2009
1 parent 40bef6c commit b8bda3b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/couchrest/more/extended_document.rb
Expand Up @@ -41,7 +41,7 @@ def self.inherited(subklass)

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']
Expand Down
5 changes: 5 additions & 0 deletions spec/couchrest/more/extended_doc_spec.rb
Expand Up @@ -129,6 +129,11 @@ def arg=(value)
@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
Expand Down

0 comments on commit b8bda3b

Please sign in to comment.