spec/mongomodel/support/map_spec.rb in mongomodel-0.4.3 vs spec/mongomodel/support/map_spec.rb in mongomodel-0.4.4
- old
+ new
@@ -210,9 +210,18 @@
it "should cast keys on #values_at" do
subject.values_at(:another, :abc).should == [doc2, doc1]
end
end
+
+ describe "map from Date to String" do
+ let(:klass) { Map[Date => String] }
+ subject { klass.new(Date.civil(2009, 11, 15) => "Hello world") }
+
+ it "should cast key to String on #to_mongo" do
+ subject.to_mongo.should == { "2009/11/15" => "Hello world" }
+ end
+ end
end
specs_for(Document, EmbeddedDocument) do
define_class(:ChildDocument, EmbeddedDocument) do
property :name, String