mongoid 1.2.6 → 1.2.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. data/VERSION +1 -1
  2. data/lib/mongoid.rb +1 -0
  3. data/lib/mongoid/associations.rb +1 -1
  4. data/lib/mongoid/attributes.rb +1 -0
  5. data/lib/mongoid/collection.rb +1 -1
  6. data/lib/mongoid/commands.rb +1 -1
  7. data/lib/mongoid/commands/delete_all.rb +2 -1
  8. data/lib/mongoid/commands/destroy_all.rb +1 -1
  9. data/lib/mongoid/components.rb +1 -0
  10. data/lib/mongoid/config.rb +3 -1
  11. data/lib/mongoid/contexts.rb +21 -0
  12. data/lib/mongoid/contexts/enumerable.rb +15 -12
  13. data/lib/mongoid/contexts/ids.rb +25 -0
  14. data/lib/mongoid/contexts/mongo.rb +25 -23
  15. data/lib/mongoid/contexts/paging.rb +2 -2
  16. data/lib/mongoid/criteria.rb +5 -43
  17. data/lib/mongoid/document.rb +1 -0
  18. data/lib/mongoid/enslavement.rb +38 -0
  19. data/lib/mongoid/fields.rb +5 -2
  20. data/lib/mongoid/identity.rb +7 -1
  21. data/lib/mongoid/named_scope.rb +2 -0
  22. data/mongoid.gemspec +8 -2
  23. data/spec/integration/mongoid/commands_spec.rb +2 -2
  24. data/spec/integration/mongoid/contexts/enumerable_spec.rb +13 -0
  25. data/spec/integration/mongoid/criteria_spec.rb +2 -2
  26. data/spec/integration/mongoid/document_spec.rb +5 -1
  27. data/spec/integration/mongoid/finders_spec.rb +85 -28
  28. data/spec/models/person.rb +1 -0
  29. data/spec/unit/mongoid/associations_spec.rb +12 -0
  30. data/spec/unit/mongoid/attributes_spec.rb +60 -51
  31. data/spec/unit/mongoid/collection_spec.rb +30 -0
  32. data/spec/unit/mongoid/commands/delete_all_spec.rb +3 -3
  33. data/spec/unit/mongoid/commands_spec.rb +16 -0
  34. data/spec/unit/mongoid/config_spec.rb +7 -0
  35. data/spec/unit/mongoid/contexts/enumerable_spec.rb +151 -11
  36. data/spec/unit/mongoid/contexts/mongo_spec.rb +168 -42
  37. data/spec/unit/mongoid/contexts_spec.rb +25 -0
  38. data/spec/unit/mongoid/criteria_spec.rb +49 -75
  39. data/spec/unit/mongoid/criterion/exclusion_spec.rb +3 -13
  40. data/spec/unit/mongoid/criterion/inclusion_spec.rb +17 -19
  41. data/spec/unit/mongoid/criterion/optional_spec.rb +25 -8
  42. data/spec/unit/mongoid/document_spec.rb +4 -0
  43. data/spec/unit/mongoid/enslavement_spec.rb +63 -0
  44. data/spec/unit/mongoid/extensions/array/conversions_spec.rb +2 -2
  45. data/spec/unit/mongoid/extensions/object/conversions_spec.rb +2 -2
  46. data/spec/unit/mongoid/extensions/proc/scoping_spec.rb +1 -1
  47. data/spec/unit/mongoid/fields_spec.rb +10 -0
  48. data/spec/unit/mongoid/finders_spec.rb +1 -1
  49. data/spec/unit/mongoid/identity_spec.rb +23 -3
  50. data/spec/unit/mongoid/named_scope_spec.rb +15 -2
  51. data/spec/unit/mongoid/scope_spec.rb +1 -1
  52. metadata +8 -2
@@ -0,0 +1,25 @@
1
+ require "spec_helper"
2
+
3
+ describe Mongoid::Contexts do
4
+
5
+ context ".context_for" do
6
+ let(:klass) { stub('klass', :embedded => false) }
7
+ let(:criteria) { stub('criteria', :klass => klass) }
8
+
9
+ context "when criteria is for a top-level Mongoid::Document" do
10
+ it "creates a Mongo context" do
11
+ Mongoid::Contexts::Mongo.expects(:new).with(criteria)
12
+ Mongoid::Contexts.context_for(criteria)
13
+ end
14
+ end
15
+
16
+ context "when criteria is for an embedded Mongoid::Document" do
17
+ it "creates a Mongo context" do
18
+ klass.stubs(:embedded).returns(true)
19
+ Mongoid::Contexts::Enumerable.expects(:new).with(criteria)
20
+ Mongoid::Contexts.context_for(criteria)
21
+ end
22
+ end
23
+ end
24
+
25
+ end
@@ -172,9 +172,7 @@ describe Mongoid::Criteria do
172
172
  end
173
173
 
174
174
  it "creates a new context" do
175
- Mongoid::Contexts::Mongo.expects(:new).with(
176
- @criteria.selector, @criteria.options, @criteria.klass
177
- ).returns(@context)
175
+ Mongoid::Contexts::Mongo.expects(:new).with(@criteria).returns(@context)
178
176
  @criteria.context.should == @context
179
177
  end
180
178
 
@@ -245,7 +243,7 @@ describe Mongoid::Criteria do
245
243
  criteria = Mongoid::Criteria.new(Person)
246
244
  collection = mock
247
245
  Person.expects(:collection).returns(collection)
248
- collection.expects(:find).with(@criteria.selector, @criteria.options).returns([])
246
+ collection.expects(:find).with(criteria.selector, criteria.options).returns([])
249
247
  criteria.entries.should == []
250
248
  end
251
249
 
@@ -372,24 +370,23 @@ describe Mongoid::Criteria do
372
370
 
373
371
  describe "#initialize" do
374
372
 
375
- context "when class is hereditary" do
376
-
377
- it "sets the _type value on the selector" do
378
- criteria = Mongoid::Criteria.new(Person)
379
- criteria.selector.should == { :_type => { "$in" => ["Doctor", "Person"] } }
380
- end
373
+ let(:criteria) { Mongoid::Criteria.new(Person) }
381
374
 
375
+ it "sets the selector to an empty hash" do
376
+ criteria.selector.should == {}
382
377
  end
383
378
 
384
- context "when class is not hereditary" do
385
-
386
- it "sets no _type value on the selector" do
387
- criteria = Mongoid::Criteria.new(Game)
388
- criteria.selector.should == {}
389
- end
379
+ it "sets the options to an empty hash" do
380
+ criteria.options.should == {}
381
+ end
390
382
 
383
+ it "sets the documents to an empty array" do
384
+ criteria.documents.should == []
391
385
  end
392
386
 
387
+ it "sets the klass to the given class" do
388
+ criteria.klass.should == Person
389
+ end
393
390
  end
394
391
 
395
392
  describe "#last" do
@@ -433,7 +430,7 @@ describe Mongoid::Criteria do
433
430
  before do
434
431
  @other = Mongoid::Criteria.new(Person)
435
432
  @other.where(:name => "Chloe").order_by([[:name, :asc]])
436
- @selector = { :_type => { "$in" => ["Doctor", "Person"] }, :title => "Sir", :age => 30, :name => "Chloe" }
433
+ @selector = { :title => "Sir", :age => 30, :name => "Chloe" }
437
434
  @options = { :skip => 40, :limit => 20, :sort => [[:name, :asc]] }
438
435
  end
439
436
 
@@ -449,7 +446,7 @@ describe Mongoid::Criteria do
449
446
 
450
447
  before do
451
448
  @other = Mongoid::Criteria.new(Person)
452
- @selector = { :_type => { "$in" => ["Doctor", "Person"] }, :title => "Sir", :age => 30 }
449
+ @selector = { :title => "Sir", :age => 30 }
453
450
  @options = { :skip => 40, :limit => 20 }
454
451
  end
455
452
 
@@ -489,7 +486,7 @@ describe Mongoid::Criteria do
489
486
 
490
487
  it "merges the criteria with the next one" do
491
488
  @new_criteria = @criteria.accepted
492
- @new_criteria.selector.should == { :_type => { "$in" => ["Doctor", "Person"] }, :title => "Sir", :terms => true }
489
+ @new_criteria.selector.should == { :title => "Sir", :terms => true }
493
490
  end
494
491
 
495
492
  context "chaining more than one scope" do
@@ -499,8 +496,7 @@ describe Mongoid::Criteria do
499
496
  end
500
497
 
501
498
  it "returns the final merged criteria" do
502
- @criteria.selector.should ==
503
- { :_type => { "$in" => ["Doctor", "Person"] }, :title => "Sir", :terms => true, :age => { "$gt" => 50 } }
499
+ @criteria.selector.should == { :title => "Sir", :terms => true, :age => { "$gt" => 50 } }
504
500
  end
505
501
 
506
502
  end
@@ -616,8 +612,7 @@ describe Mongoid::Criteria do
616
612
  end
617
613
 
618
614
  it "returns the selector plus the options" do
619
- @criteria.scoped.should ==
620
- { :where => { :title => "Sir", :_type=>{ "$in" => [ "Doctor", "Person" ] } }, :skip => 20 }
615
+ @criteria.scoped.should == { :where => { :title => "Sir" }, :skip => 20 }
621
616
  end
622
617
 
623
618
  end
@@ -640,29 +635,35 @@ describe Mongoid::Criteria do
640
635
 
641
636
  context "with a single argument" do
642
637
 
643
- before do
644
- @id = Mongo::ObjectID.new.to_s
645
- @document = stub
646
- @criteria = mock
647
- Mongoid::Criteria.expects(:new).returns(@criteria)
648
- @criteria.expects(:id).with(@id).returns(@criteria)
649
- end
638
+ context "when the arg is a string" do
639
+
640
+ before do
641
+ @id = Mongo::ObjectID.new.to_s
642
+ @document = stub
643
+ @criteria = mock
644
+ Mongoid::Criteria.expects(:new).returns(@criteria)
645
+ end
650
646
 
651
- it "creates a criteria for a string" do
652
- @criteria.expects(:one).returns(@document)
653
- @document.expects(:blank? => false)
654
- Mongoid::Criteria.translate(Person, @id)
647
+ it "delegates to #id_criteria" do
648
+ @criteria.expects(:id_criteria).with(@id).returns(@document)
649
+ Mongoid::Criteria.translate(Person, @id).should == @document
650
+ end
655
651
  end
656
652
 
657
- context "when the document is not found" do
653
+ context "when the arg is an object id" do
658
654
 
659
- it "raises an error" do
660
- @criteria.expects(:one).returns(nil)
661
- lambda { Mongoid::Criteria.translate(Person, @id) }.should raise_error
655
+ before do
656
+ @id = Mongo::ObjectID.new
657
+ @document = stub
658
+ @criteria = mock
659
+ Mongoid::Criteria.expects(:new).returns(@criteria)
662
660
  end
663
661
 
662
+ it "delegates to #id_criteria" do
663
+ @criteria.expects(:id_criteria).with(@id).returns(@document)
664
+ Mongoid::Criteria.translate(Person, @id).should == @document
665
+ end
664
666
  end
665
-
666
667
  end
667
668
 
668
669
  context "multiple arguments" do
@@ -676,40 +677,13 @@ describe Mongoid::Criteria do
676
677
  @ids << Mongo::ObjectID.new.to_s
677
678
  @documents << stub
678
679
  end
679
- @collection = stub
680
- Person.expects(:collection).returns(@collection)
680
+ @criteria = mock
681
+ Mongoid::Criteria.expects(:new).returns(@criteria)
681
682
  end
682
683
 
683
- context "when documents are found" do
684
-
685
- it "returns an ids criteria" do
686
- @collection.expects(:find).with(
687
- { :_type =>
688
- { "$in" =>
689
- ["Doctor", "Person"]
690
- },
691
- :_id =>
692
- { "$in" => @ids }
693
- }, {}).returns([{ "_id" => "4", "title" => "Sir", "_type" => "Person" }])
694
- @criteria = Mongoid::Criteria.translate(Person, @ids)
695
- end
696
-
697
- end
698
-
699
- context "when documents are not found" do
700
-
701
- it "returns an ids criteria" do
702
- @collection.expects(:find).with(
703
- { :_type =>
704
- { "$in" =>
705
- ["Doctor", "Person"]
706
- },
707
- :_id =>
708
- { "$in" => @ids }
709
- }, {}).returns([])
710
- lambda { Mongoid::Criteria.translate(Person, @ids) }.should raise_error
711
- end
712
-
684
+ it "delegates to #id_criteria" do
685
+ @criteria.expects(:id_criteria).with(@ids).returns(@documents)
686
+ Mongoid::Criteria.translate(Person, @ids).should == @documents
713
687
  end
714
688
 
715
689
  end
@@ -721,7 +695,7 @@ describe Mongoid::Criteria do
721
695
  end
722
696
 
723
697
  it "returns a criteria with a selector from the conditions" do
724
- @criteria.selector.should == { :_type => { "$in" => ["Doctor", "Person"] }, :title => "Test" }
698
+ @criteria.selector.should == { :title => "Test" }
725
699
  end
726
700
 
727
701
  it "returns a criteria with klass Person" do
@@ -737,7 +711,7 @@ describe Mongoid::Criteria do
737
711
  end
738
712
 
739
713
  it "returns a criteria with a selector from the conditions" do
740
- @criteria.selector.should == { :_type => { "$in" => ["Doctor", "Person"] }, :title => "Test" }
714
+ @criteria.selector.should == { :title => "Test" }
741
715
  end
742
716
 
743
717
  it "returns a criteria with klass Person" do
@@ -753,7 +727,7 @@ describe Mongoid::Criteria do
753
727
  end
754
728
 
755
729
  it "returns a criteria with a selector from the conditions" do
756
- @criteria.selector.should == { :_type => { "$in" => ["Doctor", "Person"] }, :title => "Test" }
730
+ @criteria.selector.should == { :title => "Test" }
757
731
  end
758
732
 
759
733
  it "returns a criteria with klass Person" do
@@ -768,7 +742,7 @@ describe Mongoid::Criteria do
768
742
  end
769
743
 
770
744
  it "adds the criteria and the options" do
771
- @criteria.selector.should == { :_type => { "$in" => ["Doctor", "Person"] }, :title => "Test" }
745
+ @criteria.selector.should == { :title => "Test" }
772
746
  @criteria.options.should == { :skip => 10 }
773
747
  end
774
748
 
@@ -12,10 +12,7 @@ describe Mongoid::Criterion::Exclusion do
12
12
  it "adds the $ne query to the selector" do
13
13
  @criteria.excludes(:title => "Bad Title", :text => "Bad Text")
14
14
  @criteria.selector.should ==
15
- { :_type =>
16
- { "$in" =>
17
- ["Doctor", "Person"]
18
- },
15
+ {
19
16
  :title =>
20
17
  { "$ne" => "Bad Title"},
21
18
  :text =>
@@ -32,10 +29,7 @@ describe Mongoid::Criterion::Exclusion do
32
29
  it "accepts id" do
33
30
  @criteria.excludes(:id => "1")
34
31
  @criteria.selector.should ==
35
- { :_type =>
36
- { "$in" =>
37
- ["Doctor", "Person"]
38
- },
32
+ {
39
33
  :_id => { "$ne" => "1" }
40
34
  }
41
35
  end
@@ -43,10 +37,7 @@ describe Mongoid::Criterion::Exclusion do
43
37
  it "accepts _id" do
44
38
  @criteria.excludes(:_id => "1")
45
39
  @criteria.selector.should ==
46
- { :_type =>
47
- { "$in" =>
48
- ["Doctor", "Person"]
49
- },
40
+ {
50
41
  :_id => { "$ne" => "1" }
51
42
  }
52
43
  end
@@ -60,7 +51,6 @@ describe Mongoid::Criterion::Exclusion do
60
51
  it "adds the exclusion to the selector" do
61
52
  @criteria.not_in(:title => ["title1", "title2"], :text => ["test"])
62
53
  @criteria.selector.should == {
63
- :_type => { "$in" => ["Doctor", "Person"] },
64
54
  :title => { "$nin" => ["title1", "title2"] },
65
55
  :text => { "$nin" => ["test"] }
66
56
  }
@@ -12,7 +12,7 @@ describe Mongoid::Criterion::Inclusion do
12
12
  it "adds the $all query to the selector" do
13
13
  @criteria.all(:title => ["title1", "title2"])
14
14
  @criteria.selector.should ==
15
- { :_type => { "$in" => ["Doctor", "Person"] },
15
+ {
16
16
  :title => { "$all" => ["title1", "title2"] }
17
17
  }
18
18
  end
@@ -30,7 +30,7 @@ describe Mongoid::Criterion::Inclusion do
30
30
  it "adds the clause to the selector" do
31
31
  @criteria.and(:title => "Title", :text => "Text")
32
32
  @criteria.selector.should ==
33
- { :_type => { "$in" => ["Doctor", "Person"] },
33
+ {
34
34
  :title => "Title",
35
35
  :text => "Text"
36
36
  }
@@ -43,7 +43,7 @@ describe Mongoid::Criterion::Inclusion do
43
43
  it "adds the $where clause to the selector" do
44
44
  @criteria.and("this.date < new Date()")
45
45
  @criteria.selector.should ==
46
- { :_type => { "$in" => ["Doctor", "Person"] },
46
+ {
47
47
  "$where" => "this.date < new Date()"
48
48
  }
49
49
  end
@@ -61,10 +61,8 @@ describe Mongoid::Criterion::Inclusion do
61
61
  it "adds the $in clause to the selector" do
62
62
  @criteria.in(:title => ["title1", "title2"], :text => ["test"])
63
63
  @criteria.selector.should ==
64
- { :_type =>
65
- { "$in" =>
66
- ["Doctor", "Person"]
67
- }, :title => { "$in" => ["title1", "title2"] }, :text => { "$in" => ["test"] }
64
+ {
65
+ :title => { "$in" => ["title1", "title2"] }, :text => { "$in" => ["test"] }
68
66
  }
69
67
  end
70
68
 
@@ -83,7 +81,7 @@ describe Mongoid::Criterion::Inclusion do
83
81
  it "adds the clause to the selector" do
84
82
  @criteria.where(:title => "Title", :text => "Text")
85
83
  @criteria.selector.should ==
86
- { :_type => { "$in" => ["Doctor", "Person"] }, :title => "Title", :text => "Text" }
84
+ { :title => "Title", :text => "Text" }
87
85
  end
88
86
 
89
87
  end
@@ -95,7 +93,7 @@ describe Mongoid::Criterion::Inclusion do
95
93
  it "returns those matching an all clause" do
96
94
  @criteria.where(:title.all => ["Sir"])
97
95
  @criteria.selector.should ==
98
- { :_type => { "$in" => ["Doctor", "Person"] }, :title => { "$all" => ["Sir"] } }
96
+ { :title => { "$all" => ["Sir"] } }
99
97
  end
100
98
 
101
99
  end
@@ -105,7 +103,7 @@ describe Mongoid::Criterion::Inclusion do
105
103
  it "returns those matching an exists clause" do
106
104
  @criteria.where(:title.exists => true)
107
105
  @criteria.selector.should ==
108
- { :_type => { "$in" => ["Doctor", "Person"] }, :title => { "$exists" => true } }
106
+ { :title => { "$exists" => true } }
109
107
  end
110
108
 
111
109
  end
@@ -115,7 +113,7 @@ describe Mongoid::Criterion::Inclusion do
115
113
  it "returns those matching a gt clause" do
116
114
  @criteria.where(:age.gt => 30)
117
115
  @criteria.selector.should ==
118
- { :_type => { "$in" => ["Doctor", "Person"] }, :age => { "$gt" => 30 } }
116
+ { :age => { "$gt" => 30 } }
119
117
  end
120
118
 
121
119
  end
@@ -125,7 +123,7 @@ describe Mongoid::Criterion::Inclusion do
125
123
  it "returns those matching a gte clause" do
126
124
  @criteria.where(:age.gte => 33)
127
125
  @criteria.selector.should ==
128
- { :_type => { "$in" => ["Doctor", "Person"] }, :age => { "$gte" => 33 } }
126
+ { :age => { "$gte" => 33 } }
129
127
  end
130
128
 
131
129
  end
@@ -135,7 +133,7 @@ describe Mongoid::Criterion::Inclusion do
135
133
  it "returns those matching an in clause" do
136
134
  @criteria.where(:title.in => ["Sir", "Madam"])
137
135
  @criteria.selector.should ==
138
- { :_type => { "$in" => ["Doctor", "Person"] }, :title => { "$in" => ["Sir", "Madam"] } }
136
+ { :title => { "$in" => ["Sir", "Madam"] } }
139
137
  end
140
138
 
141
139
  end
@@ -145,7 +143,7 @@ describe Mongoid::Criterion::Inclusion do
145
143
  it "returns those matching a lt clause" do
146
144
  @criteria.where(:age.lt => 34)
147
145
  @criteria.selector.should ==
148
- { :_type => { "$in" => ["Doctor", "Person"] }, :age => { "$lt" => 34 } }
146
+ { :age => { "$lt" => 34 } }
149
147
  end
150
148
 
151
149
  end
@@ -155,7 +153,7 @@ describe Mongoid::Criterion::Inclusion do
155
153
  it "returns those matching a lte clause" do
156
154
  @criteria.where(:age.lte => 33)
157
155
  @criteria.selector.should ==
158
- { :_type => { "$in" => ["Doctor", "Person"] }, :age => { "$lte" => 33 } }
156
+ { :age => { "$lte" => 33 } }
159
157
  end
160
158
 
161
159
  end
@@ -165,7 +163,7 @@ describe Mongoid::Criterion::Inclusion do
165
163
  it "returns those matching a ne clause" do
166
164
  @criteria.where(:age.ne => 50)
167
165
  @criteria.selector.should ==
168
- { :_type => { "$in" => ["Doctor", "Person"] }, :age => { "$ne" => 50 } }
166
+ { :age => { "$ne" => 50 } }
169
167
  end
170
168
 
171
169
  end
@@ -175,7 +173,7 @@ describe Mongoid::Criterion::Inclusion do
175
173
  it "returns those matching a nin clause" do
176
174
  @criteria.where(:title.nin => ["Esquire", "Congressman"])
177
175
  @criteria.selector.should ==
178
- { :_type => { "$in" => ["Doctor", "Person"] }, :title => { "$nin" => ["Esquire", "Congressman"] } }
176
+ { :title => { "$nin" => ["Esquire", "Congressman"] } }
179
177
  end
180
178
 
181
179
  end
@@ -185,7 +183,7 @@ describe Mongoid::Criterion::Inclusion do
185
183
  it "returns those matching a size clause" do
186
184
  @criteria.where(:aliases.size => 2)
187
185
  @criteria.selector.should ==
188
- { :_type => { "$in" => ["Doctor", "Person"] }, :aliases => { "$size" => 2 } }
186
+ { :aliases => { "$size" => 2 } }
189
187
  end
190
188
 
191
189
  end
@@ -199,7 +197,7 @@ describe Mongoid::Criterion::Inclusion do
199
197
  it "adds the $where clause to the selector" do
200
198
  @criteria.where("this.date < new Date()")
201
199
  @criteria.selector.should ==
202
- { :_type => { "$in" => ["Doctor", "Person"] }, "$where" => "this.date < new Date()" }
200
+ { "$where" => "this.date < new Date()" }
203
201
  end
204
202
 
205
203
  end
@@ -112,15 +112,32 @@ describe Mongoid::Criterion::Optional do
112
112
 
113
113
  context "when passing a single id" do
114
114
 
115
- it "adds the _id query to the selector" do
116
- id = Mongo::ObjectID.new.to_s
117
- @criteria.id(id)
118
- @criteria.selector.should == { :_type => { "$in" => ["Doctor", "Person"] }, :_id => id }
115
+ context "when the id is a string" do
116
+
117
+ it "adds the _id query to the selector" do
118
+ id = Mongo::ObjectID.new.to_s
119
+ @criteria.id(id)
120
+ @criteria.selector.should == { :_id => id }
121
+ end
122
+
123
+ it "returns self" do
124
+ id = Mongo::ObjectID.new.to_s
125
+ @criteria.id(id).should == @criteria
126
+ end
119
127
  end
120
128
 
121
- it "returns self" do
122
- id = Mongo::ObjectID.new.to_s
123
- @criteria.id(id.to_s).should == @criteria
129
+ context "when the id is an object id" do
130
+
131
+ it "adds the _id query to the selector" do
132
+ id = Mongo::ObjectID.new
133
+ @criteria.id(id)
134
+ @criteria.selector.should == { :_id => id }
135
+ end
136
+
137
+ it "returns self" do
138
+ id = Mongo::ObjectID.new
139
+ @criteria.id(id).should == @criteria
140
+ end
124
141
  end
125
142
 
126
143
  end
@@ -135,7 +152,7 @@ describe Mongoid::Criterion::Optional do
135
152
  it "adds the _id query to the selector" do
136
153
  @criteria.id(@ids)
137
154
  @criteria.selector.should ==
138
- { :_type => { "$in" => ["Doctor", "Person"] }, :_id => { "$in" => @ids } }
155
+ { :_id => { "$in" => @ids } }
139
156
  end
140
157
 
141
158
  end