mongoid-pre 2.0.0.beta1 → 2.0.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (135) hide show
  1. data/.watchr +15 -10
  2. data/HISTORY +342 -0
  3. data/README.rdoc +8 -1
  4. data/Rakefile +2 -3
  5. data/VERSION +1 -1
  6. data/lib/mongoid/associations/{embedded_in.rb → belongs_to.rb} +4 -4
  7. data/lib/mongoid/associations/belongs_to_related.rb +9 -6
  8. data/lib/mongoid/associations/{embeds_many.rb → has_many.rb} +20 -33
  9. data/lib/mongoid/associations/has_many_related.rb +4 -28
  10. data/lib/mongoid/associations/{embeds_one.rb → has_one.rb} +6 -6
  11. data/lib/mongoid/associations/options.rb +6 -1
  12. data/lib/mongoid/associations.rb +32 -41
  13. data/lib/mongoid/attributes.rb +6 -13
  14. data/lib/mongoid/collection.rb +1 -2
  15. data/lib/mongoid/commands/delete.rb +1 -1
  16. data/lib/mongoid/commands/delete_all.rb +1 -4
  17. data/lib/mongoid/commands/destroy.rb +1 -1
  18. data/lib/mongoid/commands/destroy_all.rb +1 -3
  19. data/lib/mongoid/commands/save.rb +0 -1
  20. data/lib/mongoid/commands.rb +13 -2
  21. data/lib/mongoid/components.rb +1 -6
  22. data/lib/mongoid/config.rb +1 -5
  23. data/lib/mongoid/contexts/enumerable.rb +17 -54
  24. data/lib/mongoid/contexts/mongo.rb +38 -101
  25. data/lib/mongoid/contexts/paging.rb +2 -2
  26. data/lib/mongoid/contexts.rb +0 -21
  27. data/lib/mongoid/criteria.rb +73 -15
  28. data/lib/mongoid/criterion/inclusion.rb +0 -2
  29. data/lib/mongoid/criterion/optional.rb +2 -10
  30. data/lib/mongoid/document.rb +30 -41
  31. data/lib/mongoid/extensions.rb +0 -15
  32. data/lib/mongoid/field.rb +7 -20
  33. data/lib/mongoid/fields.rb +10 -15
  34. data/lib/mongoid/finders.rb +98 -10
  35. data/lib/mongoid/identity.rb +2 -8
  36. data/lib/mongoid/named_scope.rb +0 -2
  37. data/lib/mongoid/validations/associated.rb +8 -3
  38. data/lib/mongoid/validations/uniqueness.rb +7 -2
  39. data/lib/mongoid/validations.rb +2 -2
  40. data/lib/mongoid/versioning.rb +1 -1
  41. data/lib/mongoid.rb +5 -21
  42. data/mongoid.gemspec +19 -59
  43. data/spec/integration/mongoid/associations_spec.rb +3 -42
  44. data/spec/integration/mongoid/attributes_spec.rb +2 -2
  45. data/spec/integration/mongoid/commands_spec.rb +13 -27
  46. data/spec/integration/mongoid/contexts/enumerable_spec.rb +0 -13
  47. data/spec/integration/mongoid/criteria_spec.rb +3 -50
  48. data/spec/integration/mongoid/document_spec.rb +5 -72
  49. data/spec/integration/mongoid/finders_spec.rb +28 -85
  50. data/spec/models/address.rb +3 -3
  51. data/spec/models/animal.rb +2 -2
  52. data/spec/models/country_code.rb +2 -2
  53. data/spec/models/game.rb +1 -2
  54. data/spec/models/inheritance.rb +5 -5
  55. data/spec/models/location.rb +2 -2
  56. data/spec/models/name.rb +3 -3
  57. data/spec/models/namespacing.rb +2 -2
  58. data/spec/models/patient.rb +0 -2
  59. data/spec/models/person.rb +4 -6
  60. data/spec/models/pet.rb +3 -3
  61. data/spec/models/pet_owner.rb +3 -3
  62. data/spec/models/phone.rb +3 -3
  63. data/spec/models/post.rb +1 -1
  64. data/spec/models/translation.rb +2 -2
  65. data/spec/models/vet_visit.rb +2 -2
  66. data/spec/spec_helper.rb +2 -2
  67. data/spec/unit/mongoid/associations/belongs_to_related_spec.rb +0 -4
  68. data/spec/unit/mongoid/associations/{embedded_in_spec.rb → belongs_to_spec.rb} +11 -11
  69. data/spec/unit/mongoid/associations/has_many_related_spec.rb +14 -45
  70. data/spec/unit/mongoid/associations/{embeds_many_spec.rb → has_many_spec.rb} +34 -79
  71. data/spec/unit/mongoid/associations/{embeds_one_spec.rb → has_one_spec.rb} +18 -18
  72. data/spec/unit/mongoid/associations/options_spec.rb +19 -20
  73. data/spec/unit/mongoid/associations_spec.rb +12 -74
  74. data/spec/unit/mongoid/attributes_spec.rb +51 -83
  75. data/spec/unit/mongoid/collection_spec.rb +0 -46
  76. data/spec/unit/mongoid/commands/delete_all_spec.rb +8 -9
  77. data/spec/unit/mongoid/commands/delete_spec.rb +3 -6
  78. data/spec/unit/mongoid/commands/destroy_all_spec.rb +2 -0
  79. data/spec/unit/mongoid/commands/destroy_spec.rb +3 -10
  80. data/spec/unit/mongoid/commands_spec.rb +11 -20
  81. data/spec/unit/mongoid/config_spec.rb +0 -18
  82. data/spec/unit/mongoid/contexts/enumerable_spec.rb +11 -198
  83. data/spec/unit/mongoid/contexts/mongo_spec.rb +54 -357
  84. data/spec/unit/mongoid/criteria_spec.rb +78 -107
  85. data/spec/unit/mongoid/criterion/exclusion_spec.rb +13 -3
  86. data/spec/unit/mongoid/criterion/inclusion_spec.rb +19 -25
  87. data/spec/unit/mongoid/criterion/optional_spec.rb +18 -25
  88. data/spec/unit/mongoid/document_spec.rb +34 -71
  89. data/spec/unit/mongoid/extensions/array/conversions_spec.rb +2 -2
  90. data/spec/unit/mongoid/extensions/datetime/conversions_spec.rb +3 -0
  91. data/spec/unit/mongoid/extensions/object/conversions_spec.rb +2 -16
  92. data/spec/unit/mongoid/extensions/proc/scoping_spec.rb +1 -1
  93. data/spec/unit/mongoid/field_spec.rb +0 -62
  94. data/spec/unit/mongoid/fields_spec.rb +0 -33
  95. data/spec/unit/mongoid/finders_spec.rb +1 -37
  96. data/spec/unit/mongoid/identity_spec.rb +6 -47
  97. data/spec/unit/mongoid/named_scope_spec.rb +2 -15
  98. data/spec/unit/mongoid/scope_spec.rb +1 -1
  99. data/spec/unit/mongoid/validations/uniqueness_spec.rb +3 -3
  100. data/spec/unit/mongoid_spec.rb +2 -11
  101. metadata +14 -64
  102. data/lib/mongoid/associations/meta_data.rb +0 -28
  103. data/lib/mongoid/contexts/ids.rb +0 -25
  104. data/lib/mongoid/deprecation.rb +0 -22
  105. data/lib/mongoid/dirty.rb +0 -203
  106. data/lib/mongoid/extensions/big_decimal/conversions.rb +0 -19
  107. data/lib/mongoid/extensions/binary/conversions.rb +0 -17
  108. data/lib/mongoid/extensions/objectid/conversions.rb +0 -15
  109. data/lib/mongoid/extras.rb +0 -61
  110. data/lib/mongoid/javascript/functions.yml +0 -37
  111. data/lib/mongoid/javascript.rb +0 -21
  112. data/lib/mongoid/observable.rb +0 -30
  113. data/lib/mongoid/paths.rb +0 -54
  114. data/lib/mongoid/persistence/command.rb +0 -20
  115. data/lib/mongoid/persistence/insert.rb +0 -71
  116. data/lib/mongoid/persistence/update.rb +0 -78
  117. data/lib/mongoid/persistence.rb +0 -27
  118. data/lib/mongoid/state.rb +0 -32
  119. data/spec/integration/mongoid/dirty_spec.rb +0 -70
  120. data/spec/integration/mongoid/persistence/update_spec.rb +0 -46
  121. data/spec/models/callbacks.rb +0 -18
  122. data/spec/unit/mongoid/associations/meta_data_spec.rb +0 -88
  123. data/spec/unit/mongoid/contexts_spec.rb +0 -25
  124. data/spec/unit/mongoid/deprecation_spec.rb +0 -24
  125. data/spec/unit/mongoid/dirty_spec.rb +0 -286
  126. data/spec/unit/mongoid/extensions/big_decimal/conversions_spec.rb +0 -22
  127. data/spec/unit/mongoid/extensions/binary/conversions_spec.rb +0 -22
  128. data/spec/unit/mongoid/extras_spec.rb +0 -102
  129. data/spec/unit/mongoid/javascript_spec.rb +0 -48
  130. data/spec/unit/mongoid/observable_spec.rb +0 -46
  131. data/spec/unit/mongoid/paths_spec.rb +0 -124
  132. data/spec/unit/mongoid/persistence/insert_spec.rb +0 -175
  133. data/spec/unit/mongoid/persistence/update_spec.rb +0 -148
  134. data/spec/unit/mongoid/persistence_spec.rb +0 -40
  135. data/spec/unit/mongoid/state_spec.rb +0 -83
@@ -67,73 +67,6 @@ describe Mongoid::Document do
67
67
 
68
68
  end
69
69
 
70
- describe "#eql?" do
71
-
72
- context "when other object is a Document" do
73
-
74
- context "when attributes are equal" do
75
-
76
- before do
77
- @document = Person.new(:_id => 1, :title => "Sir")
78
- @other = Person.new(:_id => 1, :title => "Sir")
79
- end
80
-
81
- it "returns true" do
82
- @document.eql?(@other).should be_true
83
- end
84
-
85
- end
86
-
87
- context "when attributes are not equal" do
88
-
89
- before do
90
- @document = Person.new(:title => "Sir")
91
- @other = Person.new(:title => "Madam")
92
- end
93
-
94
- it "returns false" do
95
- @document.eql?(@other).should_not be_true
96
- end
97
-
98
- end
99
-
100
- end
101
-
102
- context "when other object is not a Document" do
103
-
104
- it "returns false" do
105
- Person.new.eql?("Test").should be_false
106
- end
107
-
108
- end
109
-
110
- context "when comapring parent to its subclass" do
111
-
112
- it "returns false" do
113
- Canvas.new.eql?(Firefox.new).should_not be_true
114
- end
115
-
116
- end
117
-
118
- end
119
-
120
- describe "#hash" do
121
-
122
- before do
123
- @document = Person.new(:_id => 1, :title => "Sir")
124
- @other = Person.new(:_id => 2, :title => "Sir")
125
- end
126
-
127
- it "deligates to id" do
128
- @document.hash.should == @document.id.hash
129
- end
130
-
131
- it "has unique hash per id" do
132
- @document.hash.should_not == @other.hash
133
- end
134
-
135
- end
136
-
137
70
  describe "#alias_method_chain" do
138
71
 
139
72
  context "on a field setter" do
@@ -471,6 +404,34 @@ describe Mongoid::Document do
471
404
 
472
405
  end
473
406
 
407
+ describe "#new_record?" do
408
+
409
+ context "when the object has been saved" do
410
+
411
+ before do
412
+ @person = Person.new(:_id => "1")
413
+ end
414
+
415
+ it "returns false" do
416
+ @person.new_record?.should be_false
417
+ end
418
+
419
+ end
420
+
421
+ context "when the object has not been saved" do
422
+
423
+ before do
424
+ @person = Person.new
425
+ end
426
+
427
+ it "returns true" do
428
+ @person.new_record?.should be_true
429
+ end
430
+
431
+ end
432
+
433
+ end
434
+
474
435
  describe "#_parent" do
475
436
 
476
437
  before do
@@ -526,10 +487,6 @@ describe Mongoid::Document do
526
487
  @person.attributes.should == @attributes
527
488
  end
528
489
 
529
- it 'should return a person object' do
530
- @person.reload.should be_kind_of(Person)
531
- end
532
-
533
490
  end
534
491
 
535
492
  describe "#remove" do
@@ -561,7 +518,9 @@ describe Mongoid::Document do
561
518
  @person.remove(@name)
562
519
  @person.name.should be_nil
563
520
  end
521
+
564
522
  end
523
+
565
524
  end
566
525
 
567
526
  describe "#_root" do
@@ -579,6 +538,7 @@ describe Mongoid::Document do
579
538
  it "returns self" do
580
539
  @person._root.should == @person
581
540
  end
541
+
582
542
  end
583
543
 
584
544
  context "when document is embedded one level" do
@@ -586,6 +546,7 @@ describe Mongoid::Document do
586
546
  it "returns the parent" do
587
547
  @phone_number._root.should == @person
588
548
  end
549
+
589
550
  end
590
551
 
591
552
  context "when document is embedded multiple levels" do
@@ -593,7 +554,9 @@ describe Mongoid::Document do
593
554
  it "returns the top level parent" do
594
555
  @country_code._root.should == @person
595
556
  end
557
+
596
558
  end
559
+
597
560
  end
598
561
 
599
562
  describe ".store_in" do
@@ -10,8 +10,8 @@ describe Mongoid::Extensions::Array::Conversions do
10
10
  Person.new(:_id => 2, :title => "Madam")
11
11
  ]
12
12
  array.mongoidize.should ==
13
- [ HashWithIndifferentAccess.new({ :_id => 1, :title => "Sir", :age => 100, :_type => "Person", "blood_alcohol_content" => 0.0, :pets => false }),
14
- HashWithIndifferentAccess.new({ :_id => 2, :title => "Madam", :age => 100, :_type => "Person", "blood_alcohol_content" => 0.0, :pets => false }) ]
13
+ [ HashWithIndifferentAccess.new({ :_id => 1, :title => "Sir", :age => 100, :_type => "Person", "blood_alcohol_content" => 0.0 }),
14
+ HashWithIndifferentAccess.new({ :_id => 2, :title => "Madam", :age => 100, :_type => "Person", "blood_alcohol_content" => 0.0 }) ]
15
15
  end
16
16
 
17
17
  end
@@ -62,6 +62,9 @@ describe Mongoid::Extensions::DateTime::Conversions do
62
62
  it "returns nil" do
63
63
  DateTime.get(nil).should be_nil
64
64
  end
65
+
65
66
  end
67
+
66
68
  end
69
+
67
70
  end
@@ -6,14 +6,7 @@ describe Mongoid::Extensions::Object::Conversions do
6
6
 
7
7
  it "returns its attributes" do
8
8
  Person.new(:_id => 1, :title => "Sir").mongoidize.should ==
9
- {
10
- "_id" => 1,
11
- "title" => "Sir",
12
- "age" => 100,
13
- "_type" => "Person",
14
- "blood_alcohol_content" => 0.0,
15
- "pets" => false
16
- }
9
+ { "_id" => 1, "title" => "Sir", "age" => 100, "_type" => "Person", "blood_alcohol_content" => 0.0 }
17
10
  end
18
11
 
19
12
  end
@@ -35,14 +28,7 @@ describe Mongoid::Extensions::Object::Conversions do
35
28
  context "when object has attributes" do
36
29
 
37
30
  before do
38
- @attributes = {
39
- "_id" => "test",
40
- "title" => "Sir",
41
- "age" => 100,
42
- "_type" => "Person",
43
- "blood_alcohol_content" => 0.0,
44
- "pets" => false
45
- }
31
+ @attributes = { "_id" => "test", "title" => "Sir", "age" => 100, "_type" => "Person", "blood_alcohol_content" => 0.0 }
46
32
  @person = Person.new(@attributes)
47
33
  end
48
34
 
@@ -24,7 +24,7 @@ describe Mongoid::Extensions::Proc::Scoping do
24
24
 
25
25
  it "returns the criteria scoped" do
26
26
  @proc.scoped("Sir").should ==
27
- { :where => { :title => "Sir" } }
27
+ { :where => { :_type => { "$in" => [ "Doctor", "Person" ] }, :title => "Sir" } }
28
28
  end
29
29
 
30
30
  end
@@ -2,42 +2,6 @@ require "spec_helper"
2
2
 
3
3
  describe Mongoid::Field do
4
4
 
5
- describe "#accessible?" do
6
-
7
- context "when value is not set" do
8
-
9
- before do
10
- @field = Mongoid::Field.new(:name)
11
- end
12
-
13
- it "defaults to true" do
14
- @field.accessible?.should be_true
15
- end
16
- end
17
-
18
- context "when set to true" do
19
-
20
- before do
21
- @field = Mongoid::Field.new(:name, :accessible => true)
22
- end
23
-
24
- it "returns true" do
25
- @field.accessible?.should be_true
26
- end
27
- end
28
-
29
- context "when set to false" do
30
-
31
- before do
32
- @field = Mongoid::Field.new(:name, :accessible => false)
33
- end
34
-
35
- it "returns false" do
36
- @field.accessible?.should be_false
37
- end
38
- end
39
- end
40
-
41
5
  describe "#default" do
42
6
 
43
7
  before do
@@ -48,32 +12,6 @@ describe Mongoid::Field do
48
12
  @field.default.should == 0
49
13
  end
50
14
 
51
- context "when the field is an array" do
52
-
53
- before do
54
- @field = Mongoid::Field.new(:vals, :type => Array, :default => [ "first" ])
55
- end
56
-
57
- it "dups the array" do
58
- array = @field.default
59
- array << "second"
60
- @field.default.should == [ "first" ]
61
- end
62
- end
63
-
64
- context "when the field is a hash" do
65
-
66
- before do
67
- @field = Mongoid::Field.new(:vals, :type => Hash, :default => { :key => "value" })
68
- end
69
-
70
- it "dups the hash" do
71
- hash = @field.default
72
- hash[:key_two] = "value2"
73
- @field.default.should == { :key => "value" }
74
- end
75
- end
76
-
77
15
  end
78
16
 
79
17
  describe "#name" do
@@ -12,29 +12,6 @@ describe Mongoid::Fields do
12
12
 
13
13
  describe "#defaults" do
14
14
 
15
- context "with defaults specified as a non-primitive" do
16
-
17
- before do
18
- Person.field(:hash_testing, :type => Hash, :default => {})
19
- Person.field(:array_testing, :type => Array, :default => [])
20
- @first_person = Person.new
21
- @second_person = Person.new
22
- end
23
-
24
- after do
25
- Person.fields.delete("hash_testing")
26
- Person.fields.delete("array_testing")
27
- end
28
-
29
- it "should not return the same object when calling defaults with a default hash" do
30
- @first_person.hash_testing.object_id.should_not == @second_person.hash_testing.object_id
31
- end
32
-
33
- it "should not return the same object when calling defaults with a default array" do
34
- @first_person.array_testing.object_id.should_not == @second_person.array_testing.object_id
35
- end
36
- end
37
-
38
15
  context "on parent classes" do
39
16
 
40
17
  before do
@@ -80,12 +57,6 @@ describe Mongoid::Fields do
80
57
  @person.testing.should == "Testy"
81
58
  end
82
59
 
83
- it "adds an reader method with a question mark" do
84
- @person = Person.new(:testing => "Test")
85
- @person.testing?.should be_true
86
- Person.new.testing?.should be_false
87
- end
88
-
89
60
  end
90
61
 
91
62
  context "when type is an object" do
@@ -102,10 +73,6 @@ describe Mongoid::Fields do
102
73
  { "name" => "Jack and Coke" }
103
74
  end
104
75
 
105
- it "adds an reader method with a question mark" do
106
- @person.mixed_drink?.should be_true
107
- end
108
-
109
76
  end
110
77
 
111
78
  context "when type is a boolean" do
@@ -40,24 +40,6 @@ describe Mongoid::Finders do
40
40
 
41
41
  end
42
42
 
43
- describe ".all_in" do
44
-
45
- it "returns a new criteria with select conditions added" do
46
- criteria = Person.all_in(:aliases => [ "Bond", "007" ])
47
- criteria.selector.should == { :aliases => { "$all" => [ "Bond", "007" ] } }
48
- end
49
-
50
- end
51
-
52
- describe ".any_in" do
53
-
54
- it "returns a new criteria with select conditions added" do
55
- criteria = Person.any_in(:aliases => [ "Bond", "007" ])
56
- criteria.selector.should == { :aliases => { "$in" => [ "Bond", "007" ] } }
57
- end
58
-
59
- end
60
-
61
43
  describe ".count" do
62
44
 
63
45
  before do
@@ -83,15 +65,6 @@ describe Mongoid::Finders do
83
65
 
84
66
  end
85
67
 
86
- describe ".excludes" do
87
-
88
- it "returns a new criteria with select conditions added" do
89
- criteria = Person.excludes(:title => "Sir")
90
- criteria.selector.should == { :title => { "$ne" => "Sir" } }
91
- end
92
-
93
- end
94
-
95
68
  describe ".find" do
96
69
 
97
70
  before do
@@ -323,15 +296,6 @@ describe Mongoid::Finders do
323
296
 
324
297
  end
325
298
 
326
- describe ".not_in" do
327
-
328
- it "returns a new criteria with select conditions added" do
329
- criteria = Person.not_in(:aliases => [ "Bond", "007" ])
330
- criteria.selector.should == { :aliases => { "$nin" => [ "Bond", "007" ] } }
331
- end
332
-
333
- end
334
-
335
299
  describe ".paginate" do
336
300
 
337
301
  before do
@@ -396,7 +360,7 @@ describe Mongoid::Finders do
396
360
 
397
361
  it "returns a new criteria with select conditions added" do
398
362
  criteria = Person.where(:title => "Sir")
399
- criteria.selector.should == { :title => "Sir" }
363
+ criteria.selector.should == { :_type => { "$in" => ["Doctor", "Person"] }, :title => "Sir" }
400
364
  end
401
365
 
402
366
  end
@@ -6,30 +6,9 @@ describe Mongoid::Identity do
6
6
 
7
7
  let(:name) { Name.new }
8
8
 
9
- context "when persisting types" do
10
-
11
- it "sets the document _type to the class name" do
12
- Mongoid::Identity.create(name)
13
- name._type.should == "Name"
14
- end
15
-
16
- end
17
-
18
- context "when not persisting types" do
19
-
20
- before do
21
- Mongoid.persist_types = false
22
- @name = Name.new
23
- end
24
-
25
- after do
26
- Mongoid.persist_types = true
27
- end
28
-
29
- it "does not set the type" do
30
- @name._type.should be_nil
31
- end
32
-
9
+ it "sets the document _type to the class name" do
10
+ Mongoid::Identity.create(name)
11
+ name._type.should == "Name"
33
12
  end
34
13
 
35
14
  it "returns the document" do
@@ -61,29 +40,9 @@ describe Mongoid::Identity do
61
40
  Mongo::ObjectID.expects(:new).returns(@object_id)
62
41
  end
63
42
 
64
- context "when using object ids" do
65
-
66
- before do
67
- Mongoid.use_object_ids = true
68
- end
69
-
70
- after do
71
- Mongoid.use_object_ids = false
72
- end
73
-
74
- it "sets the id to a mongo object id" do
75
- Mongoid::Identity.create(@person)
76
- @person.id.should == @object_id
77
- end
78
- end
79
-
80
- context "when not using object ids" do
81
-
82
- it "sets the id to a mongo object id string" do
83
- Mongoid::Identity.create(@person)
84
- @person.id.should == "1"
85
- end
86
-
43
+ it "sets the id to a mongo object id" do
44
+ Mongoid::Identity.create(@person)
45
+ @person.id.should == "1"
87
46
  end
88
47
 
89
48
  end
@@ -17,7 +17,6 @@ describe Mongoid::NamedScope do
17
17
  named_scope :inactive, :where => { :active => false }
18
18
  named_scope :frags_over, lambda { |count| { :where => { :frags.gt => count } } }
19
19
  named_scope :deaths_under, lambda { |count| criteria.where(:deaths.lt => count) }
20
- scope :deaths_over, lambda { |count| criteria.where(:deaths.gt => count) }
21
20
 
22
21
  class << self
23
22
  def alive
@@ -74,22 +73,10 @@ describe Mongoid::NamedScope do
74
73
 
75
74
  context "when a block is supplied" do
76
75
 
77
- it "adds a class method for the scope" do
78
- Player.should respond_to(:deaths_over)
76
+ it "adds the block as an extension" do
77
+ Player.active.extension.should == "extension"
79
78
  end
80
79
 
81
- it "adds the scope to the scopes" do
82
- Player.scopes.should include(:deaths_over)
83
- end
84
-
85
- end
86
-
87
- end
88
-
89
- describe ".scope" do
90
-
91
- it "aliases to named_scope" do
92
- Player.should respond_to(:deaths_over)
93
80
  end
94
81
 
95
82
  end
@@ -232,7 +232,7 @@ describe Mongoid::Scope do
232
232
 
233
233
  it "returns the conditions criteria" do
234
234
  @scope.target.selector.should ==
235
- { :title => "Sir" }
235
+ { :title => "Sir", :_type => { "$in" => [ "Doctor", "Person" ] } }
236
236
  end
237
237
 
238
238
  end
@@ -14,7 +14,7 @@ describe Mongoid::Validations::UniquenessValidator do
14
14
 
15
15
  before do
16
16
  @criteria = stub(:empty? => false)
17
- Person.expects(:where).with(all_of(has_entry(:title, "Sir"), has_value(@document._id))).returns(@criteria)
17
+ Person.expects(:where).with(:title => "Sir").returns(@criteria)
18
18
  validator.validate_each(@document, :title, "Sir")
19
19
  end
20
20
 
@@ -28,11 +28,11 @@ describe Mongoid::Validations::UniquenessValidator do
28
28
 
29
29
  end
30
30
 
31
- context "when no other document exists with the attribute value" do
31
+ context "when no document exists with the attribute" do
32
32
 
33
33
  before do
34
34
  @criteria = stub(:empty? => true)
35
- Person.expects(:where).with(all_of(has_entry(:title, "Sir"), has_value(@document._id))).returns(@criteria)
35
+ Person.expects(:where).with(:title => "Sir").returns(@criteria)
36
36
  validator.validate_each(@document, :title, "Sir")
37
37
  end
38
38
 
@@ -9,6 +9,7 @@ describe Mongoid do
9
9
  it "returns the config singleton" do
10
10
  Mongoid.configure.should == Mongoid::Config.instance
11
11
  end
12
+
12
13
  end
13
14
 
14
15
  context "when a block is supplied" do
@@ -28,19 +29,9 @@ describe Mongoid do
28
29
  it "sets the values on the config instance" do
29
30
  Mongoid.allow_dynamic_fields.should be_false
30
31
  end
31
- end
32
- end
33
32
 
34
- describe ".deprecate" do
35
-
36
- before do
37
- @deprecation = mock
38
- Mongoid::Deprecation.expects(:instance).returns(@deprecation)
39
33
  end
40
34
 
41
- it "calls alert on the deprecation singleton" do
42
- @deprecation.expects(:alert).with("testing")
43
- Mongoid.deprecate("testing")
44
- end
45
35
  end
36
+
46
37
  end