mongoid 1.1.3 → 1.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.watchr +20 -2
- data/VERSION +1 -1
- data/caliper.yml +4 -0
- data/lib/mongoid.rb +0 -1
- data/lib/mongoid/associations.rb +25 -13
- data/lib/mongoid/associations/belongs_to.rb +15 -17
- data/lib/mongoid/associations/belongs_to_related.rb +12 -14
- data/lib/mongoid/associations/has_many.rb +53 -35
- data/lib/mongoid/associations/has_many_related.rb +10 -15
- data/lib/mongoid/associations/has_one.rb +31 -30
- data/lib/mongoid/associations/has_one_related.rb +18 -20
- data/lib/mongoid/associations/options.rb +10 -0
- data/lib/mongoid/associations/proxy.rb +18 -1
- data/lib/mongoid/criteria.rb +9 -233
- data/lib/mongoid/criterion/complex.rb +21 -0
- data/lib/mongoid/criterion/exclusion.rb +63 -0
- data/lib/mongoid/criterion/inclusion.rb +91 -0
- data/lib/mongoid/criterion/optional.rb +96 -0
- data/lib/mongoid/document.rb +2 -2
- data/lib/mongoid/extensions/hash/accessors.rb +6 -0
- data/lib/mongoid/extensions/hash/criteria_helpers.rb +2 -2
- data/lib/mongoid/extensions/symbol/inflections.rb +1 -1
- data/mongoid.gemspec +53 -3
- data/spec/integration/mongoid/associations_spec.rb +41 -0
- data/spec/models/address.rb +39 -0
- data/spec/models/animal.rb +6 -0
- data/spec/models/comment.rb +8 -0
- data/spec/models/country_code.rb +6 -0
- data/spec/models/employer.rb +5 -0
- data/spec/models/game.rb +6 -0
- data/spec/models/inheritance.rb +56 -0
- data/spec/models/location.rb +5 -0
- data/spec/models/mixed_drink.rb +4 -0
- data/spec/models/name.rb +13 -0
- data/spec/models/namespacing.rb +11 -0
- data/spec/models/patient.rb +4 -0
- data/spec/models/person.rb +97 -0
- data/spec/models/pet.rb +7 -0
- data/spec/models/pet_owner.rb +6 -0
- data/spec/models/phone.rb +7 -0
- data/spec/models/post.rb +15 -0
- data/spec/models/translation.rb +5 -0
- data/spec/models/vet_visit.rb +5 -0
- data/spec/spec_helper.rb +9 -326
- data/spec/unit/mongoid/associations/belongs_to_related_spec.rb +26 -5
- data/spec/unit/mongoid/associations/belongs_to_spec.rb +96 -30
- data/spec/unit/mongoid/associations/has_many_related_spec.rb +32 -12
- data/spec/unit/mongoid/associations/has_many_spec.rb +48 -12
- data/spec/unit/mongoid/associations/has_one_related_spec.rb +29 -4
- data/spec/unit/mongoid/associations/has_one_spec.rb +46 -1
- data/spec/unit/mongoid/associations/options_spec.rb +58 -0
- data/spec/unit/mongoid/associations_spec.rb +58 -1
- data/spec/unit/mongoid/criteria_spec.rb +71 -735
- data/spec/unit/mongoid/criterion/complex_spec.rb +19 -0
- data/spec/unit/mongoid/criterion/exclusion_spec.rb +75 -0
- data/spec/unit/mongoid/criterion/inclusion_spec.rb +213 -0
- data/spec/unit/mongoid/criterion/optional_spec.rb +244 -0
- data/spec/unit/mongoid/extensions/hash/accessors_spec.rb +20 -0
- metadata +53 -3
- data/lib/mongoid/complex_criterion.rb +0 -10
@@ -21,6 +21,26 @@ describe Mongoid::Extensions::Hash::Accessors do
|
|
21
21
|
}
|
22
22
|
end
|
23
23
|
|
24
|
+
describe "#klass" do
|
25
|
+
|
26
|
+
context "when _type exists" do
|
27
|
+
|
28
|
+
it "returns the class" do
|
29
|
+
{ "_type" => "Person" }.klass.should == Person
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
context "when _type does not exist" do
|
35
|
+
|
36
|
+
it "returns nil" do
|
37
|
+
{}.klass.should be_nil
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
24
44
|
describe "#remove" do
|
25
45
|
|
26
46
|
context "when removing from an array" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Durran Jordan
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-01-
|
12
|
+
date: 2010-01-26 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -88,6 +88,7 @@ files:
|
|
88
88
|
- README.rdoc
|
89
89
|
- Rakefile
|
90
90
|
- VERSION
|
91
|
+
- caliper.yml
|
91
92
|
- lib/mongoid.rb
|
92
93
|
- lib/mongoid/associations.rb
|
93
94
|
- lib/mongoid/associations/belongs_to.rb
|
@@ -108,7 +109,6 @@ files:
|
|
108
109
|
- lib/mongoid/commands/destroy.rb
|
109
110
|
- lib/mongoid/commands/destroy_all.rb
|
110
111
|
- lib/mongoid/commands/save.rb
|
111
|
-
- lib/mongoid/complex_criterion.rb
|
112
112
|
- lib/mongoid/components.rb
|
113
113
|
- lib/mongoid/config.rb
|
114
114
|
- lib/mongoid/contexts.rb
|
@@ -116,6 +116,10 @@ files:
|
|
116
116
|
- lib/mongoid/contexts/mongo.rb
|
117
117
|
- lib/mongoid/contexts/paging.rb
|
118
118
|
- lib/mongoid/criteria.rb
|
119
|
+
- lib/mongoid/criterion/complex.rb
|
120
|
+
- lib/mongoid/criterion/exclusion.rb
|
121
|
+
- lib/mongoid/criterion/inclusion.rb
|
122
|
+
- lib/mongoid/criterion/optional.rb
|
119
123
|
- lib/mongoid/document.rb
|
120
124
|
- lib/mongoid/errors.rb
|
121
125
|
- lib/mongoid/extensions.rb
|
@@ -173,6 +177,25 @@ files:
|
|
173
177
|
- spec/integration/mongoid/finders_spec.rb
|
174
178
|
- spec/integration/mongoid/inheritance_spec.rb
|
175
179
|
- spec/integration/mongoid/named_scope_spec.rb
|
180
|
+
- spec/models/address.rb
|
181
|
+
- spec/models/animal.rb
|
182
|
+
- spec/models/comment.rb
|
183
|
+
- spec/models/country_code.rb
|
184
|
+
- spec/models/employer.rb
|
185
|
+
- spec/models/game.rb
|
186
|
+
- spec/models/inheritance.rb
|
187
|
+
- spec/models/location.rb
|
188
|
+
- spec/models/mixed_drink.rb
|
189
|
+
- spec/models/name.rb
|
190
|
+
- spec/models/namespacing.rb
|
191
|
+
- spec/models/patient.rb
|
192
|
+
- spec/models/person.rb
|
193
|
+
- spec/models/pet.rb
|
194
|
+
- spec/models/pet_owner.rb
|
195
|
+
- spec/models/phone.rb
|
196
|
+
- spec/models/post.rb
|
197
|
+
- spec/models/translation.rb
|
198
|
+
- spec/models/vet_visit.rb
|
176
199
|
- spec/spec.opts
|
177
200
|
- spec/spec_helper.rb
|
178
201
|
- spec/unit/mongoid/associations/belongs_to_related_spec.rb
|
@@ -196,6 +219,10 @@ files:
|
|
196
219
|
- spec/unit/mongoid/contexts/enumerable_spec.rb
|
197
220
|
- spec/unit/mongoid/contexts/mongo_spec.rb
|
198
221
|
- spec/unit/mongoid/criteria_spec.rb
|
222
|
+
- spec/unit/mongoid/criterion/complex_spec.rb
|
223
|
+
- spec/unit/mongoid/criterion/exclusion_spec.rb
|
224
|
+
- spec/unit/mongoid/criterion/inclusion_spec.rb
|
225
|
+
- spec/unit/mongoid/criterion/optional_spec.rb
|
199
226
|
- spec/unit/mongoid/document_spec.rb
|
200
227
|
- spec/unit/mongoid/errors_spec.rb
|
201
228
|
- spec/unit/mongoid/extensions/array/accessors_spec.rb
|
@@ -280,6 +307,25 @@ test_files:
|
|
280
307
|
- spec/integration/mongoid/finders_spec.rb
|
281
308
|
- spec/integration/mongoid/inheritance_spec.rb
|
282
309
|
- spec/integration/mongoid/named_scope_spec.rb
|
310
|
+
- spec/models/address.rb
|
311
|
+
- spec/models/animal.rb
|
312
|
+
- spec/models/comment.rb
|
313
|
+
- spec/models/country_code.rb
|
314
|
+
- spec/models/employer.rb
|
315
|
+
- spec/models/game.rb
|
316
|
+
- spec/models/inheritance.rb
|
317
|
+
- spec/models/location.rb
|
318
|
+
- spec/models/mixed_drink.rb
|
319
|
+
- spec/models/name.rb
|
320
|
+
- spec/models/namespacing.rb
|
321
|
+
- spec/models/patient.rb
|
322
|
+
- spec/models/person.rb
|
323
|
+
- spec/models/pet.rb
|
324
|
+
- spec/models/pet_owner.rb
|
325
|
+
- spec/models/phone.rb
|
326
|
+
- spec/models/post.rb
|
327
|
+
- spec/models/translation.rb
|
328
|
+
- spec/models/vet_visit.rb
|
283
329
|
- spec/spec_helper.rb
|
284
330
|
- spec/unit/mongoid/associations/belongs_to_related_spec.rb
|
285
331
|
- spec/unit/mongoid/associations/belongs_to_spec.rb
|
@@ -302,6 +348,10 @@ test_files:
|
|
302
348
|
- spec/unit/mongoid/contexts/enumerable_spec.rb
|
303
349
|
- spec/unit/mongoid/contexts/mongo_spec.rb
|
304
350
|
- spec/unit/mongoid/criteria_spec.rb
|
351
|
+
- spec/unit/mongoid/criterion/complex_spec.rb
|
352
|
+
- spec/unit/mongoid/criterion/exclusion_spec.rb
|
353
|
+
- spec/unit/mongoid/criterion/inclusion_spec.rb
|
354
|
+
- spec/unit/mongoid/criterion/optional_spec.rb
|
305
355
|
- spec/unit/mongoid/document_spec.rb
|
306
356
|
- spec/unit/mongoid/errors_spec.rb
|
307
357
|
- spec/unit/mongoid/extensions/array/accessors_spec.rb
|