test/unit/test_embedded_document.rb in hashrocket-mongomapper-0.3.10 vs test/unit/test_embedded_document.rb in hashrocket-mongomapper-0.3.11
- old
+ new
@@ -357,9 +357,19 @@
doc.attributes.keys.sort.should == ['_id', 'name']
doc.attributes.values.should include('string')
end
end
+ context "mongodb_attributes" do
+ should "convert dates into times" do
+ document = Class.new(@document) do
+ key :start_date, Date
+ end
+ doc = document.new :start_date => "12/05/2009"
+ doc.send(:mongodb_attributes)['start_date'].should == Date.new(2009, 12, 05)
+ end
+ end
+
context "key shorcut access" do
should "be able to read key with []" do
doc = @document.new(:name => 'string')
doc[:name].should == 'string'
end