hashrocket-mongomapper 0.3.10 → 0.3.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/lib/mongomapper/embedded_document.rb +1 -1
- data/mongomapper.gemspec +2 -2
- data/test/functional/test_document.rb +16 -0
- data/test/unit/test_embedded_document.rb +10 -0
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.11
|
@@ -295,7 +295,7 @@ module MongoMapper
|
|
295
295
|
next unless association.embeddable?
|
296
296
|
next unless documents = instance_variable_get(association.ivar)
|
297
297
|
|
298
|
-
attrs[name] = documents.collect { |doc| doc.
|
298
|
+
attrs[name] = documents.collect { |doc| doc.send(:mongodb_attributes) }
|
299
299
|
end
|
300
300
|
end
|
301
301
|
end
|
data/mongomapper.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{mongomapper}
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.11"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["John Nunemaker"]
|
12
|
-
s.date = %q{2009-09-
|
12
|
+
s.date = %q{2009-09-11}
|
13
13
|
s.default_executable = %q{mmconsole}
|
14
14
|
s.email = %q{nunemaker@gmail.com}
|
15
15
|
s.executables = ["mmconsole"]
|
@@ -814,6 +814,22 @@ class DocumentTest < Test::Unit::TestCase
|
|
814
814
|
@doc.date.should == Date.new(2009, 12, 1)
|
815
815
|
end
|
816
816
|
end
|
817
|
+
|
818
|
+
context "Saving an embedded document with Date key set" do
|
819
|
+
setup do
|
820
|
+
Pet.class_eval do
|
821
|
+
key :date_of_birth, Date
|
822
|
+
end
|
823
|
+
@doc = RealPerson.new
|
824
|
+
end
|
825
|
+
|
826
|
+
should "save the Date value as a Time object" do
|
827
|
+
@doc.pets = [Pet.new(:date_of_birth => "12/01/2009")]
|
828
|
+
@doc.save
|
829
|
+
doc = RealPerson.find @doc.id
|
830
|
+
doc.pets.last.date_of_birth.should == Date.new(2009, 12, 1)
|
831
|
+
end
|
832
|
+
end
|
817
833
|
end
|
818
834
|
|
819
835
|
context "Saving an existing document" do
|
@@ -359,6 +359,16 @@ class EmbeddedDocumentTest < Test::Unit::TestCase
|
|
359
359
|
end
|
360
360
|
end
|
361
361
|
|
362
|
+
context "mongodb_attributes" do
|
363
|
+
should "convert dates into times" do
|
364
|
+
document = Class.new(@document) do
|
365
|
+
key :start_date, Date
|
366
|
+
end
|
367
|
+
doc = document.new :start_date => "12/05/2009"
|
368
|
+
doc.send(:mongodb_attributes)['start_date'].should == Date.new(2009, 12, 05)
|
369
|
+
end
|
370
|
+
end
|
371
|
+
|
362
372
|
context "key shorcut access" do
|
363
373
|
should "be able to read key with []" do
|
364
374
|
doc = @document.new(:name => 'string')
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hashrocket-mongomapper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Nunemaker
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-09-
|
12
|
+
date: 2009-09-11 00:00:00 -07:00
|
13
13
|
default_executable: mmconsole
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|