mongo_doc 0.4.2 → 0.5.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. data/.gitignore +1 -0
  2. data/HISTORY.md +8 -1
  3. data/README.textile +12 -24
  4. data/Rakefile +58 -11
  5. data/VERSION +1 -1
  6. data/features/embed_hash.feature +16 -0
  7. data/features/step_definitions/document_steps.rb +1 -1
  8. data/features/step_definitions/documents.rb +2 -0
  9. data/features/step_definitions/embed_hash_steps.rb +6 -0
  10. data/features/step_definitions/string_casting_steps.rb +2 -1
  11. data/features/support/support.rb +1 -0
  12. data/lib/mongo_doc/associations/collection_proxy.rb +29 -13
  13. data/lib/mongo_doc/associations/document_proxy.rb +14 -5
  14. data/lib/mongo_doc/associations/hash_proxy.rb +20 -16
  15. data/lib/mongo_doc/associations/proxy_base.rb +21 -26
  16. data/lib/mongo_doc/associations.rb +15 -6
  17. data/lib/mongo_doc/attributes.rb +2 -20
  18. data/lib/mongo_doc/collection.rb +1 -1
  19. data/lib/mongo_doc/connection.rb +1 -1
  20. data/lib/mongo_doc/contexts/ids.rb +3 -3
  21. data/lib/mongo_doc/contexts/mongo.rb +1 -1
  22. data/lib/mongo_doc/document.rb +30 -13
  23. data/lib/mongo_doc/ext/binary.rb +2 -2
  24. data/lib/mongo_doc/ext/dbref.rb +2 -2
  25. data/lib/mongo_doc/ext/min_max_keys.rb +13 -0
  26. data/lib/mongo_doc/ext/object.rb +4 -2
  27. data/lib/mongo_doc/ext/object_id.rb +2 -2
  28. data/lib/mongo_doc/ext.rb +1 -0
  29. data/lib/mongo_doc/finders.rb +2 -2
  30. data/lib/mongo_doc/root.rb +26 -0
  31. data/lib/mongo_doc/validations.rb +16 -0
  32. data/lib/mongo_doc.rb +2 -1
  33. data/lib/mongoid/criterion/optional.rb +1 -1
  34. data/mongo_doc.gemspec +29 -17
  35. data/perf/mongo_doc_object.rb +78 -0
  36. data/perf/mongo_document.rb +78 -0
  37. data/perf/ruby_driver.rb +43 -0
  38. data/spec/associations/collection_proxy_spec.rb +29 -6
  39. data/spec/associations/document_proxy_spec.rb +22 -19
  40. data/spec/associations/hash_proxy_spec.rb +17 -4
  41. data/spec/associations/proxy_base_spec.rb +92 -0
  42. data/spec/associations_spec.rb +4 -16
  43. data/spec/bson_spec.rb +1 -1
  44. data/spec/connection_spec.rb +2 -2
  45. data/spec/contexts/ids_spec.rb +2 -2
  46. data/spec/document_spec.rb +31 -22
  47. data/spec/ext_spec.rb +8 -0
  48. data/spec/root_spec.rb +41 -0
  49. data/spec/validations_spec.rb +30 -0
  50. metadata +46 -23
  51. data/lib/mongo_doc/query.rb +0 -7
  52. data/perf/mongo_doc_runner.rb +0 -90
  53. data/perf/ruby_driver_runner.rb +0 -64
  54. data/spec/query_spec.rb +0 -12
@@ -10,33 +10,36 @@ describe "MongoDoc::Associations::DocumentProxy" do
10
10
  end
11
11
 
12
12
  let(:parent) { Parent.new }
13
- let(:name) {'association'}
13
+ let(:name) {'association_name'}
14
14
 
15
15
  subject do
16
16
  MongoDoc::Associations::DocumentProxy.new(:assoc_name => name, :root => parent, :parent => parent, :assoc_class => Child)
17
17
  end
18
18
 
19
- it "has the association name" do
20
- subject.assoc_name.should == name
19
+ describe "#build" do
20
+ it "#build builds a new object" do
21
+ Child.should === subject.build({})
22
+ end
21
23
  end
22
24
 
23
- it "has the parent" do
24
- subject._parent.should == parent
25
+ context "delegated to the document" do
26
+ %w(id to_bson).each do |method|
27
+ it "delegates #{method} to the document" do
28
+ subject.stub(:document => stub)
29
+ subject.document.should_receive(method)
30
+ subject.send(method)
31
+ end
32
+ end
25
33
  end
26
34
 
27
- it "has the root" do
28
- subject._root.should == parent
29
- end
30
-
31
- it "has the association class" do
32
- subject.assoc_class.should == Child
33
- end
34
-
35
- it "inserts the association name the _path_to_root" do
36
- subject._path_to_root(Child.new, :name1 => 'value1', :name2 => 'value2').should == {"#{name}.name1" => 'value1', "#{name}.name2" => "value2"}
37
- end
38
-
39
- it "#build builds a new object" do
40
- Child.should === subject.build({})
35
+ %w(_modifier_path= _selector_path=).each do |setter|
36
+ describe "##{setter}" do
37
+ it "delegates to the document with our assoc name" do
38
+ subject.stub(:document => stub)
39
+ subject.document.should_receive(setter).with("new.path.#{name}")
40
+ MongoDoc::Associations::ProxyBase.stub(:is_document?).and_return(true)
41
+ subject.send("#{setter}", 'new.path')
42
+ end
43
+ end
41
44
  end
42
45
  end
@@ -7,14 +7,22 @@ describe MongoDoc::Associations::HashProxy do
7
7
  attr_accessor :name
8
8
  end
9
9
 
10
+ let(:name) { 'embed_hash_name' }
10
11
  let(:root) { HashProxyTest.new }
11
- let(:proxy) { MongoDoc::Associations::HashProxy.new(:assoc_name => 'embed_hash_name', :assoc_class => HashProxyTest, :root => root, :parent => root) }
12
+ let(:proxy) { MongoDoc::Associations::HashProxy.new(:assoc_name => name, :assoc_class => HashProxyTest, :root => root, :parent => root) }
12
13
  let(:item) { HashProxyTest.new }
13
14
  let(:other_item) {[1,2]}
14
15
 
15
- it "inserts the association name and key into the _path_to_root" do
16
- proxy.stub(:index).and_return('key')
17
- proxy._path_to_root(HashProxyTest.new, 'name' => 'value').should == {"embed_hash_name.key.name" => 'value'}
16
+ %w(_modifier_path= _selector_path=).each do |setter|
17
+ describe "##{setter}" do
18
+ it "delegates to the document with our assoc name and the key" do
19
+ document = stub
20
+ proxy.stub(:hash).and_return(:key => document)
21
+ document.should_receive(setter).with("new.path.#{name}.key")
22
+ MongoDoc::Associations::ProxyBase.stub(:is_document?).and_return(true)
23
+ proxy.send("#{setter}", 'new.path')
24
+ end
25
+ end
18
26
  end
19
27
 
20
28
  context "#[]=" do
@@ -64,6 +72,11 @@ describe MongoDoc::Associations::HashProxy do
64
72
  proxy['new'] = item
65
73
  item._root.should == root
66
74
  end
75
+
76
+ it "adds the item through a document proxy" do
77
+ proxy['new'] = item
78
+ MongoDoc::Associations::DocumentProxy.should === proxy['new']
79
+ end
67
80
  end
68
81
  end
69
82
 
@@ -0,0 +1,92 @@
1
+ require 'spec_helper'
2
+
3
+ describe "MongoDoc::Associations::ProxyBase" do
4
+ class ProxyBaseTest
5
+ include MongoDoc::Associations::ProxyBase
6
+ end
7
+
8
+ let(:_assoc_class) { 'ClassOfAssociation' }
9
+ let(:_assoc_name) { 'name_of_association' }
10
+ let(:_root) { 'root of document' }
11
+ let(:path) { 'root.parent' }
12
+
13
+ subject do
14
+ ProxyBaseTest.new({ :path => path, :assoc_class => _assoc_class, :assoc_name => _assoc_name, :root => _root })
15
+ end
16
+
17
+ %w(_assoc_class _assoc_name _modifier_path _root _selector_path).each do |attr|
18
+ it "defines #{attr}" do
19
+ should respond_to(attr)
20
+ end
21
+ end
22
+
23
+ describe "#initialize" do
24
+ %w(_assoc_class _assoc_name _root).each do |attr|
25
+ its(attr) { should == send(attr) }
26
+ end
27
+ end
28
+
29
+ describe "#_modifier_path" do
30
+ its(:_modifier_path) { should == path + '.' + _assoc_name }
31
+ end
32
+
33
+ describe "#_modifier_path=" do
34
+ it "sets the modifier path to the path + '.' + the assoc name" do
35
+ subject._modifier_path = 'new_path'
36
+ subject._modifier_path.should == "new_path.#{_assoc_name}"
37
+ end
38
+ end
39
+
40
+ describe "#_selector_path" do
41
+ its(:_selector_path) { should == path + '.' + _assoc_name }
42
+ end
43
+
44
+ describe "#_selector_path=" do
45
+ it "sets the selector path to the path + '.' + the assoc name" do
46
+ subject._selector_path = 'new_path'
47
+ subject._selector_path.should == "new_path.#{_assoc_name}"
48
+ end
49
+ end
50
+
51
+ describe ".is_document" do
52
+ class TestIsDocument
53
+ include MongoDoc::Document
54
+ end
55
+
56
+ it "returns false for any non-Document" do
57
+ MongoDoc::Associations::ProxyBase.is_document?(Object.new).should be_false
58
+ end
59
+
60
+ it "returns true for any Document" do
61
+ MongoDoc::Associations::ProxyBase.is_document?(TestIsDocument.new).should be_true
62
+ end
63
+ end
64
+
65
+ describe "#attach" do
66
+ class AttachDocument
67
+ include MongoDoc::Document
68
+ end
69
+
70
+ let(:doc) { AttachDocument.new }
71
+ let(:object) { Object.new }
72
+ let(:proxy) { ProxyBaseTest.new(:assoc_class => _assoc_class, :assoc_name => _assoc_name, :root => _root) }
73
+
74
+ it "returns the attached object" do
75
+ proxy.send(:attach, object).should == object
76
+ end
77
+
78
+ context "when a Document" do
79
+ it "attaches the Document" do
80
+ proxy.should_receive(:attach_document)
81
+ proxy.send(:attach, doc)
82
+ end
83
+ end
84
+
85
+ context "when not a Document" do
86
+ it "does not attach the Document" do
87
+ proxy.should_not_receive(:attach_document)
88
+ proxy.send(:attach, object)
89
+ end
90
+ end
91
+ end
92
+ end
@@ -32,10 +32,6 @@ describe "MongoDoc::Associations" do
32
32
  MongoDoc::Associations::DocumentProxy.should === TestHasOne.new(:sub_doc => SubDoc.new).sub_doc
33
33
  end
34
34
 
35
- it "sets the subdocuments parent to the proxy" do
36
- doc.sub_doc.should == subdoc._parent
37
- end
38
-
39
35
  it "set the subdocuments root" do
40
36
  doc.should == subdoc._root
41
37
  end
@@ -98,24 +94,20 @@ describe "MongoDoc::Associations" do
98
94
  MongoDoc::Associations::CollectionProxy.should === TestHasManyDoc.new.sub_docs
99
95
  end
100
96
 
101
- it "sets the subdocuments parent to the proxy" do
102
- doc.sub_docs.should == subdoc._parent
103
- end
104
-
105
97
  it "set the subdocuments root to the root" do
106
98
  doc.should == subdoc._root
107
99
  end
108
100
 
109
101
  it "uses the association name to find the children's class name" do
110
- TestImplicitEmbedManyDoc.new.sub_embed_many_docs.assoc_class.should == SubEmbedManyDoc
102
+ TestImplicitEmbedManyDoc.new.sub_embed_many_docs._assoc_class.should == SubEmbedManyDoc
111
103
  end
112
104
 
113
105
  it "uses class_name attribute for the children's class name" do
114
- TestEmbedManyDoc.new.sub_docs.assoc_class.should == SubEmbedManyDoc
106
+ TestEmbedManyDoc.new.sub_docs._assoc_class.should == SubEmbedManyDoc
115
107
  end
116
108
 
117
109
  it "uses class_name attribute for the children's class name" do
118
- TestEmbedManyDoc2.new.sub_docs.assoc_class.should == SubEmbedManyDoc
110
+ TestEmbedManyDoc2.new.sub_docs._assoc_class.should == SubEmbedManyDoc
119
111
  end
120
112
 
121
113
  context "validations" do
@@ -185,16 +177,12 @@ describe "MongoDoc::Associations" do
185
177
  MongoDoc::Associations::HashProxy.should === TestEmbedHashDoc.new.sub_docs
186
178
  end
187
179
 
188
- it "sets the subdocuments parent to the proxy" do
189
- doc.sub_docs.should == subdoc._parent
190
- end
191
-
192
180
  it "set the subdocuments root to the root" do
193
181
  doc.should == subdoc._root
194
182
  end
195
183
 
196
184
  it "uses the association name to find the children's class name" do
197
- TestImplicitEmbedHashDoc.new.sub_embed_hash_docs.assoc_class.should == SubEmbedHashDoc
185
+ TestImplicitEmbedHashDoc.new.sub_embed_hash_docs._assoc_class.should == SubEmbedHashDoc
198
186
  end
199
187
 
200
188
  context "validations" do
data/spec/bson_spec.rb CHANGED
@@ -140,7 +140,7 @@ describe "BSON for Mongo (BSON)" do
140
140
  end
141
141
 
142
142
  describe "Mongo Classes" do
143
- [Mongo::ObjectID.new, Mongo::DBRef.new('ns', 1), Mongo::Code.new('code'), Mongo::Binary.new].each do |obj|
143
+ [BSON::ObjectID.new, BSON::DBRef.new('ns', 1), BSON::Code.new('code'), BSON::Binary.new, BSON::MinKey.new, BSON::MaxKey.new].each do |obj|
144
144
  it "#to_bson for #{obj.class.name} returns self" do
145
145
  obj.to_bson.should == obj
146
146
  end
@@ -105,12 +105,12 @@ describe "MongoDoc::Connection.Connections" do
105
105
  let(:connection) { stub('connection') }
106
106
 
107
107
  it "raises when the server version is unsupported" do
108
- connection.stub(:server_version).and_return(Mongo::ServerVersion.new('1.3.2'))
108
+ connection.stub(:server_version).and_return(Mongo::ServerVersion.new('1.3.4'))
109
109
  lambda { MongoDoc::Connection.send(:verify_server_version, connection) }.should raise_error(MongoDoc::UnsupportedServerVersionError)
110
110
  end
111
111
 
112
112
  it "returns when the server version is supported" do
113
- connection.stub(:server_version).and_return(Mongo::ServerVersion.new('1.3.4'))
113
+ connection.stub(:server_version).and_return(Mongo::ServerVersion.new('1.4.0'))
114
114
  lambda { MongoDoc::Connection.send(:verify_server_version, connection) }.should_not raise_error(MongoDoc::UnsupportedServerVersionError)
115
115
  end
116
116
  end
@@ -16,7 +16,7 @@ describe "MongoDoc::Contexts::Ids" do
16
16
  context "#id_criteria" do
17
17
  context "single id" do
18
18
  let(:id) { 'a' * 24 }
19
- let(:obj_id) { Mongo::ObjectID.from_string(id) }
19
+ let(:obj_id) { BSON::ObjectID.from_string(id) }
20
20
 
21
21
  it "converts strings to an object id" do
22
22
  criteria.should_receive(:id).with(obj_id)
@@ -32,7 +32,7 @@ describe "MongoDoc::Contexts::Ids" do
32
32
 
33
33
  context "mutliple ids" do
34
34
  let(:ids) { ['a' * 24, 'b' * 24] }
35
- let(:obj_ids) { [Mongo::ObjectID.from_string(ids.first), Mongo::ObjectID.from_string(ids.last)] }
35
+ let(:obj_ids) { [BSON::ObjectID.from_string(ids.first), BSON::ObjectID.from_string(ids.last)] }
36
36
 
37
37
  it "converts strings to an object id" do
38
38
  criteria.should_receive(:id).with(obj_ids)
@@ -1,7 +1,28 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
1
+ require 'spec_helper'
2
2
 
3
3
  describe "MongoDoc::Document" do
4
4
 
5
+ describe "#_collection" do
6
+ class DocumentCollectionTest
7
+ include MongoDoc::Document
8
+ end
9
+
10
+ let(:doc) do
11
+ doc = DocumentCollectionTest.new
12
+ doc._root = stub
13
+ doc
14
+ end
15
+
16
+ before do
17
+ DocumentCollectionTest.stub(:collection).and_return('collection')
18
+ end
19
+
20
+ it "delegates to the root's collection" do
21
+ doc._root.should_receive :_collection
22
+ doc._collection
23
+ end
24
+ end
25
+
5
26
  context "satisfies form_for requirements" do
6
27
  class FormForTest
7
28
  include MongoDoc::Document
@@ -39,26 +60,7 @@ describe "MongoDoc::Document" do
39
60
  end
40
61
  end
41
62
 
42
- context "validations" do
43
- class SimpleValidationTest
44
- include MongoDoc::Document
45
-
46
- attr_accessor :data
47
- validates_presence_of :data
48
- end
49
-
50
- it "are included by MongoDoc::Document" do
51
- Validatable.should === SimpleValidationTest.new
52
- end
53
-
54
- it "valid? fails when a document is invalid" do
55
- doc = SimpleValidationTest.new
56
- doc.should_not be_valid
57
- doc.should have(1).error_on(:data)
58
- end
59
- end
60
-
61
- context "saving" do
63
+ context "saving" do
62
64
  class SaveRoot
63
65
  include MongoDoc::Document
64
66
 
@@ -368,6 +370,13 @@ describe "MongoDoc::Document" do
368
370
  end
369
371
  end
370
372
  end
373
+
374
+ describe "#hash_with_modifier_path_keys" do
375
+ it "returns a hash with the keys prepended with the modifier path" do
376
+ new_doc.stub(:_modifier_path).and_return('path.to.root')
377
+ new_doc.send(:hash_with_modifier_path_keys, :name => 1).should == {'path.to.root.name' => 1}
378
+ end
379
+ end
371
380
  end
372
381
 
373
382
  describe "bson" do
@@ -403,7 +412,7 @@ describe "MongoDoc::Document" do
403
412
  end
404
413
 
405
414
  it "includes the _id of the object" do
406
- @doc._id = Mongo::ObjectID.new
415
+ @doc._id = BSON::ObjectID.new
407
416
  @doc.to_bson.should be_bson_eql({MongoDoc::BSON::CLASS_KEY => BSONTest.name, "_id" => @doc._id.to_bson, "other" => {MongoDoc::BSON::CLASS_KEY => OtherObject.name, "value" => @value}})
408
417
  end
409
418
 
data/spec/ext_spec.rb CHANGED
@@ -1,6 +1,14 @@
1
1
  require 'spec_helper.rb'
2
2
 
3
3
  describe "Ruby Object Extensions" do
4
+ context "Rails3 support" do
5
+ describe "#singleton_class" do
6
+ it "is either defined or aliased" do
7
+ Object.new.should respond_to(:singleton_class)
8
+ end
9
+ end
10
+ end
11
+
4
12
  context "Conversions" do
5
13
  context "Boolean" do
6
14
  it "converts from a '1' to true" do
data/spec/root_spec.rb ADDED
@@ -0,0 +1,41 @@
1
+ require 'spec_helper'
2
+
3
+ describe "MongoDoc::Root" do
4
+ class RootTest
5
+ include MongoDoc::Root
6
+ attr_accessor_with_default(:_associations) {[]}
7
+ attr_accessor :association
8
+ end
9
+
10
+ let(:doc) { RootTest.new }
11
+
12
+ context "cascade properties" do
13
+ let(:prop_val) { stub }
14
+
15
+ %w(_modifier_path _root _selector_path).each do |prop|
16
+ it "sets the #{prop}" do
17
+ doc.send("#{prop}=", prop_val)
18
+ doc.send(prop).should == prop_val
19
+ end
20
+
21
+ it "sets the prop on any associations" do
22
+ doc.association = stub
23
+ doc.association.should_receive("#{prop}=").with(prop_val)
24
+ doc._associations = ['association']
25
+ doc.send("#{prop}=", prop_val)
26
+ end
27
+ end
28
+ end
29
+
30
+ describe "#_selector_path" do
31
+ it "defaults to ''" do
32
+ doc._selector_path.should == ''
33
+ end
34
+ end
35
+
36
+ describe "#_modifier_path" do
37
+ it "defaults to ''" do
38
+ doc._modifier_path.should == ''
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,30 @@
1
+ require 'spec_helper'
2
+
3
+ describe MongoDoc::Validations do
4
+
5
+ class ValidationTest
6
+ include MongoDoc::Document
7
+
8
+ attr_accessor :data
9
+ validates_presence_of :data
10
+ end
11
+
12
+ context "requirements" do
13
+ subject { ValidationTest.new }
14
+
15
+ it { should respond_to(:valid?) }
16
+ it { should respond_to(:errors) }
17
+
18
+ it "is included by Document" do
19
+ MongoDoc::Validations.should === subject
20
+ end
21
+ end
22
+
23
+ context "validations" do
24
+ it "valid? fails when a document is invalid" do
25
+ doc = ValidationTest.new
26
+ doc.should_not be_valid
27
+ doc.should have(1).error_on(:data)
28
+ end
29
+ end
30
+ end
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 4
8
- - 2
9
- version: 0.4.2
7
+ - 5
8
+ - 5
9
+ version: 0.5.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Les Hill
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-03-23 00:00:00 -04:00
17
+ date: 2010-04-08 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -40,13 +40,13 @@ dependencies:
40
40
  - !ruby/object:Gem::Version
41
41
  segments:
42
42
  - 0
43
- - 19
43
+ - 20
44
44
  - 1
45
- version: 0.19.1
45
+ version: 0.20.1
46
46
  type: :runtime
47
47
  version_requirements: *id002
48
48
  - !ruby/object:Gem::Dependency
49
- name: mongo_ext
49
+ name: bson
50
50
  prerelease: false
51
51
  requirement: &id003 !ruby/object:Gem::Requirement
52
52
  requirements:
@@ -54,15 +54,29 @@ dependencies:
54
54
  - !ruby/object:Gem::Version
55
55
  segments:
56
56
  - 0
57
- - 19
57
+ - 20
58
58
  - 1
59
- version: 0.19.1
59
+ version: 0.20.1
60
60
  type: :runtime
61
61
  version_requirements: *id003
62
62
  - !ruby/object:Gem::Dependency
63
- name: durran-validatable
63
+ name: bson_ext
64
64
  prerelease: false
65
65
  requirement: &id004 !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "="
68
+ - !ruby/object:Gem::Version
69
+ segments:
70
+ - 0
71
+ - 20
72
+ - 1
73
+ version: 0.20.1
74
+ type: :runtime
75
+ version_requirements: *id004
76
+ - !ruby/object:Gem::Dependency
77
+ name: durran-validatable
78
+ prerelease: false
79
+ requirement: &id005 !ruby/object:Gem::Requirement
66
80
  requirements:
67
81
  - - "="
68
82
  - !ruby/object:Gem::Version
@@ -72,11 +86,11 @@ dependencies:
72
86
  - 1
73
87
  version: 2.0.1
74
88
  type: :runtime
75
- version_requirements: *id004
89
+ version_requirements: *id005
76
90
  - !ruby/object:Gem::Dependency
77
91
  name: leshill-will_paginate
78
92
  prerelease: false
79
- requirement: &id005 !ruby/object:Gem::Requirement
93
+ requirement: &id006 !ruby/object:Gem::Requirement
80
94
  requirements:
81
95
  - - "="
82
96
  - !ruby/object:Gem::Version
@@ -86,11 +100,11 @@ dependencies:
86
100
  - 11
87
101
  version: 2.3.11
88
102
  type: :runtime
89
- version_requirements: *id005
103
+ version_requirements: *id006
90
104
  - !ruby/object:Gem::Dependency
91
105
  name: rspec
92
106
  prerelease: false
93
- requirement: &id006 !ruby/object:Gem::Requirement
107
+ requirement: &id007 !ruby/object:Gem::Requirement
94
108
  requirements:
95
109
  - - "="
96
110
  - !ruby/object:Gem::Version
@@ -100,13 +114,13 @@ dependencies:
100
114
  - 0
101
115
  version: 1.3.0
102
116
  type: :development
103
- version_requirements: *id006
117
+ version_requirements: *id007
104
118
  - !ruby/object:Gem::Dependency
105
119
  name: cucumber
106
120
  prerelease: false
107
- requirement: &id007 !ruby/object:Gem::Requirement
121
+ requirement: &id008 !ruby/object:Gem::Requirement
108
122
  requirements:
109
- - - "="
123
+ - - ">="
110
124
  - !ruby/object:Gem::Version
111
125
  segments:
112
126
  - 0
@@ -114,7 +128,7 @@ dependencies:
114
128
  - 2
115
129
  version: 0.6.2
116
130
  type: :development
117
- version_requirements: *id007
131
+ version_requirements: *id008
118
132
  description: ODM for MongoDB
119
133
  email: leshill@gmail.com
120
134
  executables: []
@@ -138,6 +152,7 @@ files:
138
152
  - examples/simple_document.rb
139
153
  - examples/simple_object.rb
140
154
  - features/collections.feature
155
+ - features/embed_hash.feature
141
156
  - features/finders.feature
142
157
  - features/indexes.feature
143
158
  - features/mongodb.yml
@@ -150,6 +165,7 @@ files:
150
165
  - features/step_definitions/collection_steps.rb
151
166
  - features/step_definitions/document_steps.rb
152
167
  - features/step_definitions/documents.rb
168
+ - features/step_definitions/embed_hash_steps.rb
153
169
  - features/step_definitions/finder_steps.rb
154
170
  - features/step_definitions/index_steps.rb
155
171
  - features/step_definitions/json_steps.rb
@@ -188,6 +204,7 @@ files:
188
204
  - lib/mongo_doc/ext/date_time.rb
189
205
  - lib/mongo_doc/ext/dbref.rb
190
206
  - lib/mongo_doc/ext/hash.rb
207
+ - lib/mongo_doc/ext/min_max_keys.rb
191
208
  - lib/mongo_doc/ext/nil_class.rb
192
209
  - lib/mongo_doc/ext/numeric.rb
193
210
  - lib/mongo_doc/ext/object.rb
@@ -199,8 +216,9 @@ files:
199
216
  - lib/mongo_doc/finders.rb
200
217
  - lib/mongo_doc/index.rb
201
218
  - lib/mongo_doc/matchers.rb
202
- - lib/mongo_doc/query.rb
219
+ - lib/mongo_doc/root.rb
203
220
  - lib/mongo_doc/scope.rb
221
+ - lib/mongo_doc/validations.rb
204
222
  - lib/mongo_doc/validations/macros.rb
205
223
  - lib/mongo_doc/validations/validates_embedded.rb
206
224
  - lib/mongoid/contexts/enumerable.rb
@@ -226,13 +244,15 @@ files:
226
244
  - mongo_doc.gemspec
227
245
  - mongod.example.yml
228
246
  - mongodb.example.yml
229
- - perf/mongo_doc_runner.rb
230
- - perf/ruby_driver_runner.rb
247
+ - perf/mongo_doc_object.rb
248
+ - perf/mongo_document.rb
249
+ - perf/ruby_driver.rb
231
250
  - script/console
232
251
  - spec/array_including_argument_matcher.rb
233
252
  - spec/associations/collection_proxy_spec.rb
234
253
  - spec/associations/document_proxy_spec.rb
235
254
  - spec/associations/hash_proxy_spec.rb
255
+ - spec/associations/proxy_base_spec.rb
236
256
  - spec/associations_spec.rb
237
257
  - spec/attributes_accessor_spec.rb
238
258
  - spec/attributes_spec.rb
@@ -256,10 +276,11 @@ files:
256
276
  - spec/mongodb.yml
257
277
  - spec/mongodb_pairs.yml
258
278
  - spec/new_record_spec.rb
259
- - spec/query_spec.rb
279
+ - spec/root_spec.rb
260
280
  - spec/scope_spec.rb
261
281
  - spec/spec.opts
262
282
  - spec/spec_helper.rb
283
+ - spec/validations_spec.rb
263
284
  has_rdoc: true
264
285
  homepage: http://github.com/leshill/mongodoc
265
286
  licenses: []
@@ -295,6 +316,7 @@ test_files:
295
316
  - spec/associations/collection_proxy_spec.rb
296
317
  - spec/associations/document_proxy_spec.rb
297
318
  - spec/associations/hash_proxy_spec.rb
319
+ - spec/associations/proxy_base_spec.rb
298
320
  - spec/associations_spec.rb
299
321
  - spec/attributes_accessor_spec.rb
300
322
  - spec/attributes_spec.rb
@@ -316,8 +338,9 @@ test_files:
316
338
  - spec/index_spec.rb
317
339
  - spec/matchers_spec.rb
318
340
  - spec/new_record_spec.rb
319
- - spec/query_spec.rb
341
+ - spec/root_spec.rb
320
342
  - spec/scope_spec.rb
321
343
  - spec/spec_helper.rb
344
+ - spec/validations_spec.rb
322
345
  - examples/simple_document.rb
323
346
  - examples/simple_object.rb
@@ -1,7 +0,0 @@
1
- module MongoDoc
2
- module Query
3
- def self.set_modifier(bson_hash)
4
- {'$set' => bson_hash}
5
- end
6
- end
7
- end