-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #164 from amco/fix_update_properties
Fix issue with nil properties not being set and passing hash with string keys issue
- Loading branch information
Showing
2 changed files
with
21 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
require 'test_helper' | ||
|
||
class TestDoc < Dolly::Document | ||
property :name, class_name: String | ||
property :email, class_name: String | ||
property :last_name, class_name: String | ||
end | ||
|
||
class PropertyManagerTest < Test::Unit::TestCase | ||
test 'write_attribute with nil value' do | ||
doc = TestDoc.new(name: 'name', last_name: nil, email: 'does not change') | ||
assert_equal(doc.name, 'name') | ||
doc.update_properties(name: nil) | ||
assert_equal(doc.name, nil) | ||
assert_equal(doc.last_name, nil) | ||
assert_equal(doc.email, 'does not change') | ||
end | ||
end |