test/test_document.rb in couchpillow-0.3.4 vs test/test_document.rb in couchpillow-0.3.5
- old
+ new
@@ -134,15 +134,15 @@
end
CouchPillow.db.
expects(:get).
with('123').
- returns( { '_type' => 'test', 'abc' => [1, 2, 3] } )
+ returns( { '_type' => 'test', 'abc' => 1 } )
d = klass.get('123')
assert d
- assert_equal [1, 2, 3], d.abc
+ assert_equal [1], d.abc
end
def test_validate_type_also_ensures_types_on_create_time
klass = Class.new(Document) do
@@ -261,8 +261,20 @@
.with('123')
.returns( { '_type' => 'something else', 'stuff' => 'data' } )
d = klass.get('123')
assert_equal nil, d
+ end
+
+
+ def test_key_with_false_values
+ d = Document.new({ :key => false }, "1")
+ assert_equal false, d.key
+ end
+
+
+ def test_key_with_nil_values
+ d = Document.new({ :key => nil }, "1")
+ assert_equal nil, d.key
end
end