mongoid-pre 2.0.0.beta1 → 2.0.0.pre
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/.watchr +15 -10
- data/HISTORY +342 -0
- data/README.rdoc +8 -1
- data/Rakefile +2 -3
- data/VERSION +1 -1
- data/lib/mongoid/associations/{embedded_in.rb → belongs_to.rb} +4 -4
- data/lib/mongoid/associations/belongs_to_related.rb +9 -6
- data/lib/mongoid/associations/{embeds_many.rb → has_many.rb} +20 -33
- data/lib/mongoid/associations/has_many_related.rb +4 -28
- data/lib/mongoid/associations/{embeds_one.rb → has_one.rb} +6 -6
- data/lib/mongoid/associations/options.rb +6 -1
- data/lib/mongoid/associations.rb +32 -41
- data/lib/mongoid/attributes.rb +6 -13
- data/lib/mongoid/collection.rb +1 -2
- data/lib/mongoid/commands/delete.rb +1 -1
- data/lib/mongoid/commands/delete_all.rb +1 -4
- data/lib/mongoid/commands/destroy.rb +1 -1
- data/lib/mongoid/commands/destroy_all.rb +1 -3
- data/lib/mongoid/commands/save.rb +0 -1
- data/lib/mongoid/commands.rb +13 -2
- data/lib/mongoid/components.rb +1 -6
- data/lib/mongoid/config.rb +1 -5
- data/lib/mongoid/contexts/enumerable.rb +17 -54
- data/lib/mongoid/contexts/mongo.rb +38 -101
- data/lib/mongoid/contexts/paging.rb +2 -2
- data/lib/mongoid/contexts.rb +0 -21
- data/lib/mongoid/criteria.rb +73 -15
- data/lib/mongoid/criterion/inclusion.rb +0 -2
- data/lib/mongoid/criterion/optional.rb +2 -10
- data/lib/mongoid/document.rb +30 -41
- data/lib/mongoid/extensions.rb +0 -15
- data/lib/mongoid/field.rb +7 -20
- data/lib/mongoid/fields.rb +10 -15
- data/lib/mongoid/finders.rb +98 -10
- data/lib/mongoid/identity.rb +2 -8
- data/lib/mongoid/named_scope.rb +0 -2
- data/lib/mongoid/validations/associated.rb +8 -3
- data/lib/mongoid/validations/uniqueness.rb +7 -2
- data/lib/mongoid/validations.rb +2 -2
- data/lib/mongoid/versioning.rb +1 -1
- data/lib/mongoid.rb +5 -21
- data/mongoid.gemspec +19 -59
- data/spec/integration/mongoid/associations_spec.rb +3 -42
- data/spec/integration/mongoid/attributes_spec.rb +2 -2
- data/spec/integration/mongoid/commands_spec.rb +13 -27
- data/spec/integration/mongoid/contexts/enumerable_spec.rb +0 -13
- data/spec/integration/mongoid/criteria_spec.rb +3 -50
- data/spec/integration/mongoid/document_spec.rb +5 -72
- data/spec/integration/mongoid/finders_spec.rb +28 -85
- data/spec/models/address.rb +3 -3
- data/spec/models/animal.rb +2 -2
- data/spec/models/country_code.rb +2 -2
- data/spec/models/game.rb +1 -2
- data/spec/models/inheritance.rb +5 -5
- data/spec/models/location.rb +2 -2
- data/spec/models/name.rb +3 -3
- data/spec/models/namespacing.rb +2 -2
- data/spec/models/patient.rb +0 -2
- data/spec/models/person.rb +4 -6
- data/spec/models/pet.rb +3 -3
- data/spec/models/pet_owner.rb +3 -3
- data/spec/models/phone.rb +3 -3
- data/spec/models/post.rb +1 -1
- data/spec/models/translation.rb +2 -2
- data/spec/models/vet_visit.rb +2 -2
- data/spec/spec_helper.rb +2 -2
- data/spec/unit/mongoid/associations/belongs_to_related_spec.rb +0 -4
- data/spec/unit/mongoid/associations/{embedded_in_spec.rb → belongs_to_spec.rb} +11 -11
- data/spec/unit/mongoid/associations/has_many_related_spec.rb +14 -45
- data/spec/unit/mongoid/associations/{embeds_many_spec.rb → has_many_spec.rb} +34 -79
- data/spec/unit/mongoid/associations/{embeds_one_spec.rb → has_one_spec.rb} +18 -18
- data/spec/unit/mongoid/associations/options_spec.rb +19 -20
- data/spec/unit/mongoid/associations_spec.rb +12 -74
- data/spec/unit/mongoid/attributes_spec.rb +51 -83
- data/spec/unit/mongoid/collection_spec.rb +0 -46
- data/spec/unit/mongoid/commands/delete_all_spec.rb +8 -9
- data/spec/unit/mongoid/commands/delete_spec.rb +3 -6
- data/spec/unit/mongoid/commands/destroy_all_spec.rb +2 -0
- data/spec/unit/mongoid/commands/destroy_spec.rb +3 -10
- data/spec/unit/mongoid/commands_spec.rb +11 -20
- data/spec/unit/mongoid/config_spec.rb +0 -18
- data/spec/unit/mongoid/contexts/enumerable_spec.rb +11 -198
- data/spec/unit/mongoid/contexts/mongo_spec.rb +54 -357
- data/spec/unit/mongoid/criteria_spec.rb +78 -107
- data/spec/unit/mongoid/criterion/exclusion_spec.rb +13 -3
- data/spec/unit/mongoid/criterion/inclusion_spec.rb +19 -25
- data/spec/unit/mongoid/criterion/optional_spec.rb +18 -25
- data/spec/unit/mongoid/document_spec.rb +34 -71
- data/spec/unit/mongoid/extensions/array/conversions_spec.rb +2 -2
- data/spec/unit/mongoid/extensions/datetime/conversions_spec.rb +3 -0
- data/spec/unit/mongoid/extensions/object/conversions_spec.rb +2 -16
- data/spec/unit/mongoid/extensions/proc/scoping_spec.rb +1 -1
- data/spec/unit/mongoid/field_spec.rb +0 -62
- data/spec/unit/mongoid/fields_spec.rb +0 -33
- data/spec/unit/mongoid/finders_spec.rb +1 -37
- data/spec/unit/mongoid/identity_spec.rb +6 -47
- data/spec/unit/mongoid/named_scope_spec.rb +2 -15
- data/spec/unit/mongoid/scope_spec.rb +1 -1
- data/spec/unit/mongoid/validations/uniqueness_spec.rb +3 -3
- data/spec/unit/mongoid_spec.rb +2 -11
- metadata +14 -64
- data/lib/mongoid/associations/meta_data.rb +0 -28
- data/lib/mongoid/contexts/ids.rb +0 -25
- data/lib/mongoid/deprecation.rb +0 -22
- data/lib/mongoid/dirty.rb +0 -203
- data/lib/mongoid/extensions/big_decimal/conversions.rb +0 -19
- data/lib/mongoid/extensions/binary/conversions.rb +0 -17
- data/lib/mongoid/extensions/objectid/conversions.rb +0 -15
- data/lib/mongoid/extras.rb +0 -61
- data/lib/mongoid/javascript/functions.yml +0 -37
- data/lib/mongoid/javascript.rb +0 -21
- data/lib/mongoid/observable.rb +0 -30
- data/lib/mongoid/paths.rb +0 -54
- data/lib/mongoid/persistence/command.rb +0 -20
- data/lib/mongoid/persistence/insert.rb +0 -71
- data/lib/mongoid/persistence/update.rb +0 -78
- data/lib/mongoid/persistence.rb +0 -27
- data/lib/mongoid/state.rb +0 -32
- data/spec/integration/mongoid/dirty_spec.rb +0 -70
- data/spec/integration/mongoid/persistence/update_spec.rb +0 -46
- data/spec/models/callbacks.rb +0 -18
- data/spec/unit/mongoid/associations/meta_data_spec.rb +0 -88
- data/spec/unit/mongoid/contexts_spec.rb +0 -25
- data/spec/unit/mongoid/deprecation_spec.rb +0 -24
- data/spec/unit/mongoid/dirty_spec.rb +0 -286
- data/spec/unit/mongoid/extensions/big_decimal/conversions_spec.rb +0 -22
- data/spec/unit/mongoid/extensions/binary/conversions_spec.rb +0 -22
- data/spec/unit/mongoid/extras_spec.rb +0 -102
- data/spec/unit/mongoid/javascript_spec.rb +0 -48
- data/spec/unit/mongoid/observable_spec.rb +0 -46
- data/spec/unit/mongoid/paths_spec.rb +0 -124
- data/spec/unit/mongoid/persistence/insert_spec.rb +0 -175
- data/spec/unit/mongoid/persistence/update_spec.rb +0 -148
- data/spec/unit/mongoid/persistence_spec.rb +0 -40
- data/spec/unit/mongoid/state_spec.rb +0 -83
data/mongoid.gemspec
CHANGED
|
@@ -5,11 +5,10 @@
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
7
|
s.name = %q{mongoid}
|
|
8
|
-
s.version = "2.0.0.
|
|
9
|
-
|
|
8
|
+
s.version = "2.0.0.pre"
|
|
10
9
|
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
|
|
11
10
|
s.authors = ["Durran Jordan"]
|
|
12
|
-
s.date = %q{2010-
|
|
11
|
+
s.date = %q{2010-02-09}
|
|
13
12
|
s.email = %q{durran@gmail.com}
|
|
14
13
|
s.extra_rdoc_files = [
|
|
15
14
|
"README.rdoc"
|
|
@@ -17,6 +16,7 @@ Gem::Specification.new do |s|
|
|
|
17
16
|
s.files = [
|
|
18
17
|
".gitignore",
|
|
19
18
|
".watchr",
|
|
19
|
+
"HISTORY",
|
|
20
20
|
"MIT_LICENSE",
|
|
21
21
|
"README.rdoc",
|
|
22
22
|
"Rakefile",
|
|
@@ -24,13 +24,12 @@ Gem::Specification.new do |s|
|
|
|
24
24
|
"caliper.yml",
|
|
25
25
|
"lib/mongoid.rb",
|
|
26
26
|
"lib/mongoid/associations.rb",
|
|
27
|
+
"lib/mongoid/associations/belongs_to.rb",
|
|
27
28
|
"lib/mongoid/associations/belongs_to_related.rb",
|
|
28
|
-
"lib/mongoid/associations/
|
|
29
|
-
"lib/mongoid/associations/embed_one.rb",
|
|
30
|
-
"lib/mongoid/associations/embedded_in.rb",
|
|
29
|
+
"lib/mongoid/associations/has_many.rb",
|
|
31
30
|
"lib/mongoid/associations/has_many_related.rb",
|
|
31
|
+
"lib/mongoid/associations/has_one.rb",
|
|
32
32
|
"lib/mongoid/associations/has_one_related.rb",
|
|
33
|
-
"lib/mongoid/associations/meta_data.rb",
|
|
34
33
|
"lib/mongoid/associations/options.rb",
|
|
35
34
|
"lib/mongoid/associations/proxy.rb",
|
|
36
35
|
"lib/mongoid/attributes.rb",
|
|
@@ -53,7 +52,6 @@ Gem::Specification.new do |s|
|
|
|
53
52
|
"lib/mongoid/config.rb",
|
|
54
53
|
"lib/mongoid/contexts.rb",
|
|
55
54
|
"lib/mongoid/contexts/enumerable.rb",
|
|
56
|
-
"lib/mongoid/contexts/ids.rb",
|
|
57
55
|
"lib/mongoid/contexts/mongo.rb",
|
|
58
56
|
"lib/mongoid/contexts/paging.rb",
|
|
59
57
|
"lib/mongoid/criteria.rb",
|
|
@@ -62,8 +60,6 @@ Gem::Specification.new do |s|
|
|
|
62
60
|
"lib/mongoid/criterion/inclusion.rb",
|
|
63
61
|
"lib/mongoid/criterion/optional.rb",
|
|
64
62
|
"lib/mongoid/cursor.rb",
|
|
65
|
-
"lib/mongoid/deprecation.rb",
|
|
66
|
-
"lib/mongoid/dirty.rb",
|
|
67
63
|
"lib/mongoid/document.rb",
|
|
68
64
|
"lib/mongoid/errors.rb",
|
|
69
65
|
"lib/mongoid/extensions.rb",
|
|
@@ -72,8 +68,6 @@ Gem::Specification.new do |s|
|
|
|
72
68
|
"lib/mongoid/extensions/array/assimilation.rb",
|
|
73
69
|
"lib/mongoid/extensions/array/conversions.rb",
|
|
74
70
|
"lib/mongoid/extensions/array/parentization.rb",
|
|
75
|
-
"lib/mongoid/extensions/big_decimal/conversions.rb",
|
|
76
|
-
"lib/mongoid/extensions/binary/conversions.rb",
|
|
77
71
|
"lib/mongoid/extensions/boolean/conversions.rb",
|
|
78
72
|
"lib/mongoid/extensions/date/conversions.rb",
|
|
79
73
|
"lib/mongoid/extensions/datetime/conversions.rb",
|
|
@@ -86,21 +80,17 @@ Gem::Specification.new do |s|
|
|
|
86
80
|
"lib/mongoid/extensions/integer/conversions.rb",
|
|
87
81
|
"lib/mongoid/extensions/nil/assimilation.rb",
|
|
88
82
|
"lib/mongoid/extensions/object/conversions.rb",
|
|
89
|
-
"lib/mongoid/extensions/objectid/conversions.rb",
|
|
90
83
|
"lib/mongoid/extensions/proc/scoping.rb",
|
|
91
84
|
"lib/mongoid/extensions/string/conversions.rb",
|
|
92
85
|
"lib/mongoid/extensions/string/inflections.rb",
|
|
93
86
|
"lib/mongoid/extensions/symbol/inflections.rb",
|
|
94
87
|
"lib/mongoid/extensions/time/conversions.rb",
|
|
95
|
-
"lib/mongoid/extras.rb",
|
|
96
88
|
"lib/mongoid/factory.rb",
|
|
97
89
|
"lib/mongoid/field.rb",
|
|
98
90
|
"lib/mongoid/fields.rb",
|
|
99
91
|
"lib/mongoid/finders.rb",
|
|
100
92
|
"lib/mongoid/identity.rb",
|
|
101
93
|
"lib/mongoid/indexes.rb",
|
|
102
|
-
"lib/mongoid/javascript.rb",
|
|
103
|
-
"lib/mongoid/javascript/functions.yml",
|
|
104
94
|
"lib/mongoid/matchers.rb",
|
|
105
95
|
"lib/mongoid/matchers/all.rb",
|
|
106
96
|
"lib/mongoid/matchers/default.rb",
|
|
@@ -115,14 +105,10 @@ Gem::Specification.new do |s|
|
|
|
115
105
|
"lib/mongoid/matchers/size.rb",
|
|
116
106
|
"lib/mongoid/memoization.rb",
|
|
117
107
|
"lib/mongoid/named_scope.rb",
|
|
118
|
-
"lib/mongoid/observable.rb",
|
|
119
|
-
"lib/mongoid/paths.rb",
|
|
120
108
|
"lib/mongoid/scope.rb",
|
|
121
|
-
"lib/mongoid/state.rb",
|
|
122
109
|
"lib/mongoid/timestamps.rb",
|
|
123
110
|
"lib/mongoid/validations.rb",
|
|
124
111
|
"lib/mongoid/validations/associated.rb",
|
|
125
|
-
"lib/mongoid/validations/locale/en.yml",
|
|
126
112
|
"lib/mongoid/validations/uniqueness.rb",
|
|
127
113
|
"lib/mongoid/versioning.rb",
|
|
128
114
|
"mongoid.gemspec",
|
|
@@ -132,7 +118,6 @@ Gem::Specification.new do |s|
|
|
|
132
118
|
"spec/integration/mongoid/commands_spec.rb",
|
|
133
119
|
"spec/integration/mongoid/contexts/enumerable_spec.rb",
|
|
134
120
|
"spec/integration/mongoid/criteria_spec.rb",
|
|
135
|
-
"spec/integration/mongoid/dirty_spec.rb",
|
|
136
121
|
"spec/integration/mongoid/document_spec.rb",
|
|
137
122
|
"spec/integration/mongoid/extensions_spec.rb",
|
|
138
123
|
"spec/integration/mongoid/finders_spec.rb",
|
|
@@ -140,7 +125,6 @@ Gem::Specification.new do |s|
|
|
|
140
125
|
"spec/integration/mongoid/named_scope_spec.rb",
|
|
141
126
|
"spec/models/address.rb",
|
|
142
127
|
"spec/models/animal.rb",
|
|
143
|
-
"spec/models/callbacks.rb",
|
|
144
128
|
"spec/models/comment.rb",
|
|
145
129
|
"spec/models/country_code.rb",
|
|
146
130
|
"spec/models/employer.rb",
|
|
@@ -161,12 +145,11 @@ Gem::Specification.new do |s|
|
|
|
161
145
|
"spec/spec.opts",
|
|
162
146
|
"spec/spec_helper.rb",
|
|
163
147
|
"spec/unit/mongoid/associations/belongs_to_related_spec.rb",
|
|
164
|
-
"spec/unit/mongoid/associations/
|
|
165
|
-
"spec/unit/mongoid/associations/embed_one_spec.rb",
|
|
166
|
-
"spec/unit/mongoid/associations/embedded_in_spec.rb",
|
|
148
|
+
"spec/unit/mongoid/associations/belongs_to_spec.rb",
|
|
167
149
|
"spec/unit/mongoid/associations/has_many_related_spec.rb",
|
|
150
|
+
"spec/unit/mongoid/associations/has_many_spec.rb",
|
|
168
151
|
"spec/unit/mongoid/associations/has_one_related_spec.rb",
|
|
169
|
-
"spec/unit/mongoid/associations/
|
|
152
|
+
"spec/unit/mongoid/associations/has_one_spec.rb",
|
|
170
153
|
"spec/unit/mongoid/associations/options_spec.rb",
|
|
171
154
|
"spec/unit/mongoid/associations_spec.rb",
|
|
172
155
|
"spec/unit/mongoid/attributes_spec.rb",
|
|
@@ -186,23 +169,18 @@ Gem::Specification.new do |s|
|
|
|
186
169
|
"spec/unit/mongoid/config_spec.rb",
|
|
187
170
|
"spec/unit/mongoid/contexts/enumerable_spec.rb",
|
|
188
171
|
"spec/unit/mongoid/contexts/mongo_spec.rb",
|
|
189
|
-
"spec/unit/mongoid/contexts_spec.rb",
|
|
190
172
|
"spec/unit/mongoid/criteria_spec.rb",
|
|
191
173
|
"spec/unit/mongoid/criterion/complex_spec.rb",
|
|
192
174
|
"spec/unit/mongoid/criterion/exclusion_spec.rb",
|
|
193
175
|
"spec/unit/mongoid/criterion/inclusion_spec.rb",
|
|
194
176
|
"spec/unit/mongoid/criterion/optional_spec.rb",
|
|
195
177
|
"spec/unit/mongoid/cursor_spec.rb",
|
|
196
|
-
"spec/unit/mongoid/deprecation_spec.rb",
|
|
197
|
-
"spec/unit/mongoid/dirty_spec.rb",
|
|
198
178
|
"spec/unit/mongoid/document_spec.rb",
|
|
199
179
|
"spec/unit/mongoid/errors_spec.rb",
|
|
200
180
|
"spec/unit/mongoid/extensions/array/accessors_spec.rb",
|
|
201
181
|
"spec/unit/mongoid/extensions/array/assimilation_spec.rb",
|
|
202
182
|
"spec/unit/mongoid/extensions/array/conversions_spec.rb",
|
|
203
183
|
"spec/unit/mongoid/extensions/array/parentization_spec.rb",
|
|
204
|
-
"spec/unit/mongoid/extensions/big_decimal/conversions_spec.rb",
|
|
205
|
-
"spec/unit/mongoid/extensions/binary/conversions_spec.rb",
|
|
206
184
|
"spec/unit/mongoid/extensions/boolean/conversions_spec.rb",
|
|
207
185
|
"spec/unit/mongoid/extensions/date/conversions_spec.rb",
|
|
208
186
|
"spec/unit/mongoid/extensions/datetime/conversions_spec.rb",
|
|
@@ -220,14 +198,12 @@ Gem::Specification.new do |s|
|
|
|
220
198
|
"spec/unit/mongoid/extensions/string/inflections_spec.rb",
|
|
221
199
|
"spec/unit/mongoid/extensions/symbol/inflections_spec.rb",
|
|
222
200
|
"spec/unit/mongoid/extensions/time/conversions_spec.rb",
|
|
223
|
-
"spec/unit/mongoid/extras_spec.rb",
|
|
224
201
|
"spec/unit/mongoid/factory_spec.rb",
|
|
225
202
|
"spec/unit/mongoid/field_spec.rb",
|
|
226
203
|
"spec/unit/mongoid/fields_spec.rb",
|
|
227
204
|
"spec/unit/mongoid/finders_spec.rb",
|
|
228
205
|
"spec/unit/mongoid/identity_spec.rb",
|
|
229
206
|
"spec/unit/mongoid/indexes_spec.rb",
|
|
230
|
-
"spec/unit/mongoid/javascript_spec.rb",
|
|
231
207
|
"spec/unit/mongoid/matchers/all_spec.rb",
|
|
232
208
|
"spec/unit/mongoid/matchers/default_spec.rb",
|
|
233
209
|
"spec/unit/mongoid/matchers/exists_spec.rb",
|
|
@@ -242,10 +218,7 @@ Gem::Specification.new do |s|
|
|
|
242
218
|
"spec/unit/mongoid/matchers_spec.rb",
|
|
243
219
|
"spec/unit/mongoid/memoization_spec.rb",
|
|
244
220
|
"spec/unit/mongoid/named_scope_spec.rb",
|
|
245
|
-
"spec/unit/mongoid/observable_spec.rb",
|
|
246
|
-
"spec/unit/mongoid/paths_spec.rb",
|
|
247
221
|
"spec/unit/mongoid/scope_spec.rb",
|
|
248
|
-
"spec/unit/mongoid/state_spec.rb",
|
|
249
222
|
"spec/unit/mongoid/timestamps_spec.rb",
|
|
250
223
|
"spec/unit/mongoid/validations/associated_spec.rb",
|
|
251
224
|
"spec/unit/mongoid/validations/uniqueness_spec.rb",
|
|
@@ -256,7 +229,7 @@ Gem::Specification.new do |s|
|
|
|
256
229
|
s.homepage = %q{http://mongoid.org}
|
|
257
230
|
s.rdoc_options = ["--charset=UTF-8"]
|
|
258
231
|
s.require_paths = ["lib"]
|
|
259
|
-
s.rubygems_version = %q{1.3.
|
|
232
|
+
s.rubygems_version = %q{1.3.5}
|
|
260
233
|
s.summary = %q{ODM framework for MongoDB}
|
|
261
234
|
s.test_files = [
|
|
262
235
|
"spec/integration/mongoid/associations_spec.rb",
|
|
@@ -264,7 +237,6 @@ Gem::Specification.new do |s|
|
|
|
264
237
|
"spec/integration/mongoid/commands_spec.rb",
|
|
265
238
|
"spec/integration/mongoid/contexts/enumerable_spec.rb",
|
|
266
239
|
"spec/integration/mongoid/criteria_spec.rb",
|
|
267
|
-
"spec/integration/mongoid/dirty_spec.rb",
|
|
268
240
|
"spec/integration/mongoid/document_spec.rb",
|
|
269
241
|
"spec/integration/mongoid/extensions_spec.rb",
|
|
270
242
|
"spec/integration/mongoid/finders_spec.rb",
|
|
@@ -272,7 +244,6 @@ Gem::Specification.new do |s|
|
|
|
272
244
|
"spec/integration/mongoid/named_scope_spec.rb",
|
|
273
245
|
"spec/models/address.rb",
|
|
274
246
|
"spec/models/animal.rb",
|
|
275
|
-
"spec/models/callbacks.rb",
|
|
276
247
|
"spec/models/comment.rb",
|
|
277
248
|
"spec/models/country_code.rb",
|
|
278
249
|
"spec/models/employer.rb",
|
|
@@ -292,12 +263,11 @@ Gem::Specification.new do |s|
|
|
|
292
263
|
"spec/models/vet_visit.rb",
|
|
293
264
|
"spec/spec_helper.rb",
|
|
294
265
|
"spec/unit/mongoid/associations/belongs_to_related_spec.rb",
|
|
295
|
-
"spec/unit/mongoid/associations/
|
|
296
|
-
"spec/unit/mongoid/associations/embed_one_spec.rb",
|
|
297
|
-
"spec/unit/mongoid/associations/embedded_in_spec.rb",
|
|
266
|
+
"spec/unit/mongoid/associations/belongs_to_spec.rb",
|
|
298
267
|
"spec/unit/mongoid/associations/has_many_related_spec.rb",
|
|
268
|
+
"spec/unit/mongoid/associations/has_many_spec.rb",
|
|
299
269
|
"spec/unit/mongoid/associations/has_one_related_spec.rb",
|
|
300
|
-
"spec/unit/mongoid/associations/
|
|
270
|
+
"spec/unit/mongoid/associations/has_one_spec.rb",
|
|
301
271
|
"spec/unit/mongoid/associations/options_spec.rb",
|
|
302
272
|
"spec/unit/mongoid/associations_spec.rb",
|
|
303
273
|
"spec/unit/mongoid/attributes_spec.rb",
|
|
@@ -317,23 +287,18 @@ Gem::Specification.new do |s|
|
|
|
317
287
|
"spec/unit/mongoid/config_spec.rb",
|
|
318
288
|
"spec/unit/mongoid/contexts/enumerable_spec.rb",
|
|
319
289
|
"spec/unit/mongoid/contexts/mongo_spec.rb",
|
|
320
|
-
"spec/unit/mongoid/contexts_spec.rb",
|
|
321
290
|
"spec/unit/mongoid/criteria_spec.rb",
|
|
322
291
|
"spec/unit/mongoid/criterion/complex_spec.rb",
|
|
323
292
|
"spec/unit/mongoid/criterion/exclusion_spec.rb",
|
|
324
293
|
"spec/unit/mongoid/criterion/inclusion_spec.rb",
|
|
325
294
|
"spec/unit/mongoid/criterion/optional_spec.rb",
|
|
326
295
|
"spec/unit/mongoid/cursor_spec.rb",
|
|
327
|
-
"spec/unit/mongoid/deprecation_spec.rb",
|
|
328
|
-
"spec/unit/mongoid/dirty_spec.rb",
|
|
329
296
|
"spec/unit/mongoid/document_spec.rb",
|
|
330
297
|
"spec/unit/mongoid/errors_spec.rb",
|
|
331
298
|
"spec/unit/mongoid/extensions/array/accessors_spec.rb",
|
|
332
299
|
"spec/unit/mongoid/extensions/array/assimilation_spec.rb",
|
|
333
300
|
"spec/unit/mongoid/extensions/array/conversions_spec.rb",
|
|
334
301
|
"spec/unit/mongoid/extensions/array/parentization_spec.rb",
|
|
335
|
-
"spec/unit/mongoid/extensions/big_decimal/conversions_spec.rb",
|
|
336
|
-
"spec/unit/mongoid/extensions/binary/conversions_spec.rb",
|
|
337
302
|
"spec/unit/mongoid/extensions/boolean/conversions_spec.rb",
|
|
338
303
|
"spec/unit/mongoid/extensions/date/conversions_spec.rb",
|
|
339
304
|
"spec/unit/mongoid/extensions/datetime/conversions_spec.rb",
|
|
@@ -351,14 +316,12 @@ Gem::Specification.new do |s|
|
|
|
351
316
|
"spec/unit/mongoid/extensions/string/inflections_spec.rb",
|
|
352
317
|
"spec/unit/mongoid/extensions/symbol/inflections_spec.rb",
|
|
353
318
|
"spec/unit/mongoid/extensions/time/conversions_spec.rb",
|
|
354
|
-
"spec/unit/mongoid/extras_spec.rb",
|
|
355
319
|
"spec/unit/mongoid/factory_spec.rb",
|
|
356
320
|
"spec/unit/mongoid/field_spec.rb",
|
|
357
321
|
"spec/unit/mongoid/fields_spec.rb",
|
|
358
322
|
"spec/unit/mongoid/finders_spec.rb",
|
|
359
323
|
"spec/unit/mongoid/identity_spec.rb",
|
|
360
324
|
"spec/unit/mongoid/indexes_spec.rb",
|
|
361
|
-
"spec/unit/mongoid/javascript_spec.rb",
|
|
362
325
|
"spec/unit/mongoid/matchers/all_spec.rb",
|
|
363
326
|
"spec/unit/mongoid/matchers/default_spec.rb",
|
|
364
327
|
"spec/unit/mongoid/matchers/exists_spec.rb",
|
|
@@ -373,10 +336,7 @@ Gem::Specification.new do |s|
|
|
|
373
336
|
"spec/unit/mongoid/matchers_spec.rb",
|
|
374
337
|
"spec/unit/mongoid/memoization_spec.rb",
|
|
375
338
|
"spec/unit/mongoid/named_scope_spec.rb",
|
|
376
|
-
"spec/unit/mongoid/observable_spec.rb",
|
|
377
|
-
"spec/unit/mongoid/paths_spec.rb",
|
|
378
339
|
"spec/unit/mongoid/scope_spec.rb",
|
|
379
|
-
"spec/unit/mongoid/state_spec.rb",
|
|
380
340
|
"spec/unit/mongoid/timestamps_spec.rb",
|
|
381
341
|
"spec/unit/mongoid/validations/associated_spec.rb",
|
|
382
342
|
"spec/unit/mongoid/validations/uniqueness_spec.rb",
|
|
@@ -392,21 +352,21 @@ Gem::Specification.new do |s|
|
|
|
392
352
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
|
393
353
|
s.add_runtime_dependency(%q<activemodel>, [">= 3.0.pre"])
|
|
394
354
|
s.add_runtime_dependency(%q<will_paginate>, [">= 3.0.pre"])
|
|
395
|
-
s.add_runtime_dependency(%q<mongo>, [">= 0.
|
|
396
|
-
s.add_development_dependency(%q<rspec>, [">= 1.
|
|
355
|
+
s.add_runtime_dependency(%q<mongo>, [">= 0.18.2"])
|
|
356
|
+
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
|
397
357
|
s.add_development_dependency(%q<mocha>, [">= 0.9.8"])
|
|
398
358
|
else
|
|
399
359
|
s.add_dependency(%q<activemodel>, [">= 3.0.pre"])
|
|
400
360
|
s.add_dependency(%q<will_paginate>, [">= 3.0.pre"])
|
|
401
|
-
s.add_dependency(%q<mongo>, [">= 0.
|
|
402
|
-
s.add_dependency(%q<rspec>, [">= 1.
|
|
361
|
+
s.add_dependency(%q<mongo>, [">= 0.18.2"])
|
|
362
|
+
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
|
403
363
|
s.add_dependency(%q<mocha>, [">= 0.9.8"])
|
|
404
364
|
end
|
|
405
365
|
else
|
|
406
366
|
s.add_dependency(%q<activemodel>, [">= 3.0.pre"])
|
|
407
367
|
s.add_dependency(%q<will_paginate>, [">= 3.0.pre"])
|
|
408
|
-
s.add_dependency(%q<mongo>, [">= 0.
|
|
409
|
-
s.add_dependency(%q<rspec>, [">= 1.
|
|
368
|
+
s.add_dependency(%q<mongo>, [">= 0.18.2"])
|
|
369
|
+
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
|
410
370
|
s.add_dependency(%q<mocha>, [">= 0.9.8"])
|
|
411
371
|
end
|
|
412
372
|
end
|
|
@@ -20,7 +20,7 @@ describe Mongoid::Associations do
|
|
|
20
20
|
@person.save
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
-
context "when defined on
|
|
23
|
+
context "when defined on a has_many" do
|
|
24
24
|
|
|
25
25
|
it "applies the extension" do
|
|
26
26
|
addresses = @person.addresses.find_by_street("Oxford")
|
|
@@ -49,16 +49,6 @@ describe Mongoid::Associations do
|
|
|
49
49
|
|
|
50
50
|
end
|
|
51
51
|
|
|
52
|
-
context "creation of an embedded association on a callback" do
|
|
53
|
-
|
|
54
|
-
it "allows the use of create!" do
|
|
55
|
-
artist = Artist.create!(:name => "Depeche Mode")
|
|
56
|
-
artist.songs.size.should == 2
|
|
57
|
-
artist.songs.first.title.should == "0"
|
|
58
|
-
artist.songs.last.title.should == "1"
|
|
59
|
-
end
|
|
60
|
-
end
|
|
61
|
-
|
|
62
52
|
context "criteria on has many embedded associations" do
|
|
63
53
|
|
|
64
54
|
before do
|
|
@@ -226,33 +216,10 @@ describe Mongoid::Associations do
|
|
|
226
216
|
|
|
227
217
|
end
|
|
228
218
|
|
|
229
|
-
context "calling criteria methods" do
|
|
230
|
-
|
|
231
|
-
before do
|
|
232
|
-
@post.title = "New Title"
|
|
233
|
-
@post.save
|
|
234
|
-
end
|
|
235
|
-
|
|
236
|
-
it "returns the proper object for the criteria" do
|
|
237
|
-
posts = @from_db.posts.where(:title => "New Title")
|
|
238
|
-
posts.size.should == 1
|
|
239
|
-
end
|
|
240
|
-
|
|
241
|
-
context "when calling with a new criteria" do
|
|
242
|
-
|
|
243
|
-
before do
|
|
244
|
-
@from_db.posts.create(:title => "Other Title")
|
|
245
|
-
end
|
|
246
|
-
|
|
247
|
-
it "does not retain the old criteria" do
|
|
248
|
-
@from_db.posts.where(:title => "New Title").size.should == 1
|
|
249
|
-
@from_db.posts.size.should == 2
|
|
250
|
-
@from_db.posts.where(:title => "Other Title").size.should == 1
|
|
251
|
-
end
|
|
252
|
-
end
|
|
253
|
-
end
|
|
254
219
|
end
|
|
220
|
+
|
|
255
221
|
end
|
|
222
|
+
|
|
256
223
|
end
|
|
257
224
|
|
|
258
225
|
context "nested embedded associations" do
|
|
@@ -273,12 +240,6 @@ describe Mongoid::Associations do
|
|
|
273
240
|
@person.name.last_name.should == "Brown"
|
|
274
241
|
end
|
|
275
242
|
|
|
276
|
-
it "sets the new_record values properly" do
|
|
277
|
-
from_db = Person.find(@person.id)
|
|
278
|
-
new_name = from_db.create_name(:first_name => "Flash")
|
|
279
|
-
new_name.new_record?.should be_false
|
|
280
|
-
end
|
|
281
|
-
|
|
282
243
|
end
|
|
283
244
|
|
|
284
245
|
context "multiple levels nested" do
|
|
@@ -12,9 +12,9 @@ describe Mongoid::Attributes do
|
|
|
12
12
|
Person.delete_all
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
-
it "the field should exist
|
|
15
|
+
it "the field should not exist" do
|
|
16
16
|
from_db = Person.find(@person.id)
|
|
17
|
-
from_db.attributes.has_key?(:score).should
|
|
17
|
+
from_db.attributes.has_key?(:score).should be_false
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
end
|
|
@@ -3,7 +3,7 @@ require "spec_helper"
|
|
|
3
3
|
describe Mongoid::Commands do
|
|
4
4
|
|
|
5
5
|
before do
|
|
6
|
-
@person = Person.new(:title => "Sir", :ssn => "6969696"
|
|
6
|
+
@person = Person.new(:title => "Sir", :ssn => "6969696")
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
after do
|
|
@@ -142,8 +142,11 @@ describe Mongoid::Commands do
|
|
|
142
142
|
from_db = Person.find(@person.id)
|
|
143
143
|
from_db.addresses.should be_empty
|
|
144
144
|
end
|
|
145
|
+
|
|
145
146
|
end
|
|
147
|
+
|
|
146
148
|
end
|
|
149
|
+
|
|
147
150
|
end
|
|
148
151
|
|
|
149
152
|
describe "#save" do
|
|
@@ -185,46 +188,29 @@ describe Mongoid::Commands do
|
|
|
185
188
|
end
|
|
186
189
|
|
|
187
190
|
it "saves the attributes" do
|
|
188
|
-
@person.update_attributes(:ssn => "555-55-1235", :
|
|
191
|
+
@person.update_attributes(:ssn => "555-55-1235", :title => "Blah")
|
|
189
192
|
@from_db = Person.find(@person.id)
|
|
190
|
-
@from_db.
|
|
191
|
-
@from_db.pets.should == false
|
|
192
|
-
@from_db.title.should be_nil
|
|
193
|
+
@from_db.title.should == "Blah"
|
|
193
194
|
end
|
|
194
195
|
|
|
195
196
|
end
|
|
196
197
|
|
|
197
198
|
end
|
|
198
199
|
|
|
199
|
-
describe "
|
|
200
|
-
|
|
201
|
-
before do
|
|
202
|
-
@person.save
|
|
203
|
-
end
|
|
200
|
+
describe ".delete_all" do
|
|
204
201
|
|
|
205
|
-
it "
|
|
206
|
-
Person.delete_all
|
|
207
|
-
Person.count.should == 0
|
|
202
|
+
it "returns true" do
|
|
203
|
+
Person.delete_all.should be_true
|
|
208
204
|
end
|
|
209
205
|
|
|
210
|
-
it "returns the number of documents deleted" do
|
|
211
|
-
Person.delete_all.should == 1
|
|
212
|
-
end
|
|
213
206
|
end
|
|
214
207
|
|
|
215
|
-
describe "
|
|
216
|
-
|
|
217
|
-
before do
|
|
218
|
-
@person.save
|
|
219
|
-
end
|
|
208
|
+
describe ".destroy_all" do
|
|
220
209
|
|
|
221
|
-
it "
|
|
222
|
-
Person.destroy_all
|
|
223
|
-
Person.count.should == 0
|
|
210
|
+
it "returns true" do
|
|
211
|
+
Person.destroy_all.should be_true
|
|
224
212
|
end
|
|
225
213
|
|
|
226
|
-
it "returns the number of documents destroyed" do
|
|
227
|
-
Person.destroy_all.should == 1
|
|
228
|
-
end
|
|
229
214
|
end
|
|
215
|
+
|
|
230
216
|
end
|
|
@@ -17,17 +17,4 @@ describe Mongoid::Contexts::Enumerable do
|
|
|
17
17
|
addresses.size.should == 5
|
|
18
18
|
end
|
|
19
19
|
end
|
|
20
|
-
|
|
21
|
-
describe "limit and skip" do
|
|
22
|
-
|
|
23
|
-
it "limits" do
|
|
24
|
-
@person.addresses.criteria.limit(5).size.should == 5
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
it "skips" do
|
|
28
|
-
@person.addresses.criteria.skip(5).limit(10).
|
|
29
|
-
map(&:number).should == [5, 6, 7, 8, 9]
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
end
|
|
33
20
|
end
|
|
@@ -10,27 +10,6 @@ describe Mongoid::Criteria do
|
|
|
10
10
|
Person.delete_all
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
-
describe "#avg" do
|
|
14
|
-
|
|
15
|
-
context "without results" do
|
|
16
|
-
it "should return nil" do
|
|
17
|
-
Person.avg(:age).should == nil
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
context "with results" do
|
|
22
|
-
before do
|
|
23
|
-
10.times do |n|
|
|
24
|
-
Person.create(:title => "Sir", :age => ((n + 1) * 10), :aliases => ["D", "Durran"], :ssn => "#{n}")
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
it "provides min for the field provided" do
|
|
29
|
-
Person.avg(:age).should == 55
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
|
|
34
13
|
describe "#excludes" do
|
|
35
14
|
|
|
36
15
|
before do
|
|
@@ -71,33 +50,6 @@ describe Mongoid::Criteria do
|
|
|
71
50
|
end
|
|
72
51
|
end
|
|
73
52
|
|
|
74
|
-
describe "#in" do
|
|
75
|
-
|
|
76
|
-
context "when searching nil values" do
|
|
77
|
-
|
|
78
|
-
before do
|
|
79
|
-
@person = Person.create(:title => nil)
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
it "returns the correct document" do
|
|
83
|
-
from_db = Person.any_in(:title => [ true, false, nil ]).first
|
|
84
|
-
from_db.should == @person
|
|
85
|
-
end
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
context "when searching false values" do
|
|
89
|
-
|
|
90
|
-
before do
|
|
91
|
-
@person = Person.create(:terms => false)
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
it "returns the correct document" do
|
|
95
|
-
from_db = Person.criteria.in(:terms => [ true, false, nil ]).first
|
|
96
|
-
from_db.should == @person
|
|
97
|
-
end
|
|
98
|
-
end
|
|
99
|
-
end
|
|
100
|
-
|
|
101
53
|
describe "#max" do
|
|
102
54
|
|
|
103
55
|
context "without results" do
|
|
@@ -117,6 +69,7 @@ describe Mongoid::Criteria do
|
|
|
117
69
|
Person.max(:age).should == 90.0
|
|
118
70
|
end
|
|
119
71
|
end
|
|
72
|
+
|
|
120
73
|
end
|
|
121
74
|
|
|
122
75
|
describe "#min" do
|
|
@@ -263,9 +216,9 @@ describe Mongoid::Criteria do
|
|
|
263
216
|
|
|
264
217
|
it "iterates over the cursor only once" do
|
|
265
218
|
criteria = Person.where(:title => "Sir").cache
|
|
266
|
-
criteria.collect.
|
|
219
|
+
criteria.collect.size.should == 10
|
|
267
220
|
# Do it again!
|
|
268
|
-
criteria.collect.
|
|
221
|
+
criteria.collect.size.should == 10
|
|
269
222
|
end
|
|
270
223
|
end
|
|
271
224
|
|