mongoid 6.1.0 → 6.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (132) hide show
  1. checksums.yaml +4 -4
  2. data/lib/mongoid/atomic.rb +3 -3
  3. data/lib/mongoid/attributes.rb +1 -2
  4. data/lib/mongoid/attributes/dynamic.rb +3 -2
  5. data/lib/mongoid/attributes/nested.rb +1 -1
  6. data/lib/mongoid/attributes/processing.rb +0 -4
  7. data/lib/mongoid/changeable.rb +1 -1
  8. data/lib/mongoid/clients/options.rb +1 -1
  9. data/lib/mongoid/composable.rb +3 -1
  10. data/lib/mongoid/contextual/atomic.rb +1 -1
  11. data/lib/mongoid/contextual/geo_near.rb +3 -2
  12. data/lib/mongoid/contextual/memory.rb +3 -3
  13. data/lib/mongoid/contextual/mongo.rb +5 -5
  14. data/lib/mongoid/contextual/none.rb +14 -2
  15. data/lib/mongoid/copyable.rb +1 -5
  16. data/lib/mongoid/criteria.rb +2 -2
  17. data/lib/mongoid/criteria/findable.rb +3 -2
  18. data/lib/mongoid/criteria/includable.rb +2 -2
  19. data/lib/mongoid/criteria/queryable/aggregable.rb +1 -1
  20. data/lib/mongoid/criteria/queryable/extensions/array.rb +1 -1
  21. data/lib/mongoid/criteria/queryable/extensions/boolean.rb +1 -1
  22. data/lib/mongoid/criteria/queryable/extensions/hash.rb +4 -4
  23. data/lib/mongoid/criteria/queryable/extensions/object.rb +4 -4
  24. data/lib/mongoid/criteria/queryable/extensions/regexp.rb +34 -0
  25. data/lib/mongoid/criteria/queryable/options.rb +16 -0
  26. data/lib/mongoid/criteria/queryable/selector.rb +1 -1
  27. data/lib/mongoid/document.rb +1 -1
  28. data/lib/mongoid/errors/delete_restriction.rb +2 -2
  29. data/lib/mongoid/errors/inverse_not_found.rb +1 -1
  30. data/lib/mongoid/extensions/hash.rb +3 -2
  31. data/lib/mongoid/extensions/object.rb +2 -2
  32. data/lib/mongoid/extensions/time.rb +1 -1
  33. data/lib/mongoid/factory.rb +0 -1
  34. data/lib/mongoid/fields/foreign_key.rb +2 -2
  35. data/lib/mongoid/findable.rb +1 -1
  36. data/lib/mongoid/indexable.rb +3 -2
  37. data/lib/mongoid/indexable/specification.rb +1 -1
  38. data/lib/mongoid/interceptable.rb +3 -9
  39. data/lib/mongoid/loggable.rb +1 -1
  40. data/lib/mongoid/matchable.rb +16 -9
  41. data/lib/mongoid/matchable/all.rb +2 -2
  42. data/lib/mongoid/matchable/and.rb +3 -3
  43. data/lib/mongoid/matchable/default.rb +2 -2
  44. data/lib/mongoid/matchable/elem_match.rb +3 -3
  45. data/lib/mongoid/matchable/exists.rb +2 -2
  46. data/lib/mongoid/matchable/gt.rb +2 -2
  47. data/lib/mongoid/matchable/gte.rb +2 -2
  48. data/lib/mongoid/matchable/in.rb +2 -2
  49. data/lib/mongoid/matchable/lt.rb +2 -2
  50. data/lib/mongoid/matchable/lte.rb +2 -2
  51. data/lib/mongoid/matchable/ne.rb +2 -2
  52. data/lib/mongoid/matchable/nin.rb +2 -2
  53. data/lib/mongoid/matchable/or.rb +3 -3
  54. data/lib/mongoid/matchable/regexp.rb +27 -0
  55. data/lib/mongoid/matchable/size.rb +2 -2
  56. data/lib/mongoid/persistable.rb +0 -3
  57. data/lib/mongoid/persistable/creatable.rb +2 -4
  58. data/lib/mongoid/persistable/deletable.rb +1 -1
  59. data/lib/mongoid/persistable/settable.rb +1 -1
  60. data/lib/mongoid/persistable/upsertable.rb +1 -1
  61. data/lib/mongoid/persistence_context.rb +2 -3
  62. data/lib/mongoid/relations/accessors.rb +1 -2
  63. data/lib/mongoid/relations/bindings/embedded/in.rb +0 -4
  64. data/lib/mongoid/relations/bindings/embedded/many.rb +1 -8
  65. data/lib/mongoid/relations/bindings/embedded/one.rb +0 -10
  66. data/lib/mongoid/relations/bindings/referenced/many.rb +0 -4
  67. data/lib/mongoid/relations/bindings/referenced/many_to_many.rb +4 -4
  68. data/lib/mongoid/relations/builders/embedded/one.rb +1 -1
  69. data/lib/mongoid/relations/builders/nested_attributes/many.rb +1 -1
  70. data/lib/mongoid/relations/conversions.rb +1 -1
  71. data/lib/mongoid/relations/counter_cache.rb +10 -10
  72. data/lib/mongoid/relations/eager.rb +6 -11
  73. data/lib/mongoid/relations/eager/base.rb +4 -4
  74. data/lib/mongoid/relations/embedded/batchable.rb +3 -3
  75. data/lib/mongoid/relations/embedded/in.rb +1 -3
  76. data/lib/mongoid/relations/embedded/many.rb +12 -9
  77. data/lib/mongoid/relations/embedded/one.rb +1 -3
  78. data/lib/mongoid/relations/macros.rb +3 -2
  79. data/lib/mongoid/relations/metadata.rb +3 -3
  80. data/lib/mongoid/relations/nested_builder.rb +1 -1
  81. data/lib/mongoid/relations/proxy.rb +3 -2
  82. data/lib/mongoid/relations/referenced/in.rb +1 -4
  83. data/lib/mongoid/relations/referenced/many.rb +5 -7
  84. data/lib/mongoid/relations/referenced/many_to_many.rb +2 -2
  85. data/lib/mongoid/relations/referenced/one.rb +0 -2
  86. data/lib/mongoid/relations/reflections.rb +2 -2
  87. data/lib/mongoid/relations/synchronization.rb +11 -11
  88. data/lib/mongoid/scopable.rb +2 -2
  89. data/lib/mongoid/serializable.rb +4 -3
  90. data/lib/mongoid/tasks/database.rb +2 -1
  91. data/lib/mongoid/threaded.rb +4 -4
  92. data/lib/mongoid/validatable.rb +1 -1
  93. data/lib/mongoid/validatable/macros.rb +4 -2
  94. data/lib/mongoid/version.rb +1 -1
  95. data/lib/rails/generators/mongoid/config/templates/mongoid.yml +12 -2
  96. data/spec/app/models/book.rb +2 -1
  97. data/spec/app/models/page.rb +1 -1
  98. data/spec/mongoid/contextual/none_spec.rb +15 -0
  99. data/spec/mongoid/criteria/queryable/extensions/regexp_raw_spec.rb +89 -0
  100. data/spec/mongoid/criteria/queryable/selectable_spec.rb +15 -0
  101. data/spec/mongoid/criteria_spec.rb +6 -2
  102. data/spec/mongoid/interceptable_spec.rb +19 -0
  103. data/spec/mongoid/matchable/all_spec.rb +4 -4
  104. data/spec/mongoid/matchable/and_spec.rb +10 -10
  105. data/spec/mongoid/matchable/default_spec.rb +12 -12
  106. data/spec/mongoid/matchable/elem_match_spec.rb +11 -11
  107. data/spec/mongoid/matchable/exists_spec.rb +5 -5
  108. data/spec/mongoid/matchable/gt_spec.rb +8 -8
  109. data/spec/mongoid/matchable/gte_spec.rb +8 -8
  110. data/spec/mongoid/matchable/in_spec.rb +5 -5
  111. data/spec/mongoid/matchable/lt_spec.rb +8 -8
  112. data/spec/mongoid/matchable/lte_spec.rb +8 -8
  113. data/spec/mongoid/matchable/ne_spec.rb +5 -5
  114. data/spec/mongoid/matchable/nin_spec.rb +5 -5
  115. data/spec/mongoid/matchable/or_spec.rb +7 -7
  116. data/spec/mongoid/matchable/regexp_spec.rb +59 -0
  117. data/spec/mongoid/matchable/size_spec.rb +3 -3
  118. data/spec/mongoid/matchable_spec.rb +108 -58
  119. data/spec/mongoid/persistable/deletable_spec.rb +15 -0
  120. data/spec/mongoid/persistable/settable_spec.rb +16 -0
  121. data/spec/mongoid/persistence_context_spec.rb +22 -1
  122. data/spec/mongoid/relations/bindings/referenced/many_to_many_spec.rb +4 -4
  123. data/spec/mongoid/relations/embedded/many_spec.rb +24 -6
  124. data/spec/mongoid/relations/referenced/many_to_many_spec.rb +1 -1
  125. data/spec/mongoid/relations/synchronization_spec.rb +48 -2
  126. data/spec/mongoid/relations/touchable_spec.rb +40 -0
  127. data/spec/mongoid/validatable/uniqueness_spec.rb +2 -0
  128. data/spec/spec_helper.rb +1 -1
  129. metadata +9 -26
  130. checksums.yaml.gz.sig +0 -0
  131. data.tar.gz.sig +0 -1
  132. metadata.gz.sig +0 -1
@@ -36,7 +36,8 @@ module Mongoid
36
36
  # @example Return the list of unused indexes.
37
37
  # Mongoid::Tasks::Database.undefined_indexes
38
38
  #
39
- # @return Hash{Class => Array(Hash)} The list of undefined indexes by model.
39
+ # @return [ Array<Hash> ] The list of undefined indexes by model.
40
+ #
40
41
  def undefined_indexes(models = ::Mongoid.models)
41
42
  undefined_by_model = {}
42
43
 
@@ -64,7 +64,7 @@ module Mongoid
64
64
  # @example Set the global database override.
65
65
  # Threaded.database_override = :testing
66
66
  #
67
- # @param [ String, Symbol ] The global override name.
67
+ # @param [ String, Symbol ] name The global override name.
68
68
  #
69
69
  # @return [ String, Symbol ] The override.
70
70
  #
@@ -180,7 +180,7 @@ module Mongoid
180
180
  # @example Set the global client override.
181
181
  # Threaded.client_override = :testing
182
182
  #
183
- # @param [ String, Symbol ] The global override name.
183
+ # @param [ String, Symbol ] name The global override name.
184
184
  #
185
185
  # @return [ String, Symbol ] The override.
186
186
  #
@@ -304,7 +304,7 @@ module Mongoid
304
304
  # @example Get all autosaves.
305
305
  # Threaded.autosaves_for(Person)
306
306
  #
307
- # @param [ Class ] The class to check.
307
+ # @param [ Class ] klass The class to check.
308
308
  #
309
309
  # @return [ Array ] The current autosaves.
310
310
  #
@@ -317,7 +317,7 @@ module Mongoid
317
317
  # @example Get all validations.
318
318
  # Threaded.validations_for(Person)
319
319
  #
320
- # @param [ Class ] The class to check.
320
+ # @param [ Class ] klass The class to check.
321
321
  #
322
322
  # @return [ Array ] The current validations.
323
323
  #
@@ -144,7 +144,7 @@ module Mongoid
144
144
  # @example Validate with a specific validator.
145
145
  # validates_with MyValidator, on: :create
146
146
  #
147
- # @param [ Class<Array>, Hash ] *args The validator classes and options.
147
+ # @param [ Class<Array>, Hash ] args The validator classes and options.
148
148
  #
149
149
  # @note See ActiveModel::Validations::With for full options. This is
150
150
  # overridden to add autosave functionality when presence validation is
@@ -17,7 +17,8 @@ module Mongoid
17
17
  # validates_associated :name, :addresses
18
18
  # end
19
19
  #
20
- # @param [ Array ] *args The arguments to pass to the validator.
20
+ # @param [ Array ] args The arguments to pass to the validator.
21
+ #
21
22
  def validates_associated(*args)
22
23
  validates_with(AssociatedValidator, _merge_attributes(args))
23
24
  end
@@ -34,7 +35,8 @@ module Mongoid
34
35
  # validates_uniqueness_of :title
35
36
  # end
36
37
  #
37
- # @param [ Array ] *args The arguments to pass to the validator.
38
+ # @param [ Array ] args The arguments to pass to the validator.
39
+ #
38
40
  def validates_uniqueness_of(*args)
39
41
  validates_with(UniquenessValidator, _merge_attributes(args))
40
42
  end
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module Mongoid
3
- VERSION = "6.1.0"
3
+ VERSION = "6.1.1"
4
4
  end
@@ -34,8 +34,9 @@ development:
34
34
  # - 'dbOwner'
35
35
 
36
36
  # Change the default authentication mechanism. Valid options are: :scram,
37
- # :mongodb_cr, :mongodb_x509, and :plain. (default on 3.0 is :scram, default
38
- # on 2.4 and 2.6 is :plain)
37
+ # :mongodb_cr, :mongodb_x509, and :plain. Note that all authentication
38
+ # mechanisms require username and password, with the exception of :mongodb_x509.
39
+ # Default on mongoDB 3.0 is :scram, default on 2.4 and 2.6 is :plain.
39
40
  # auth_mech: :scram
40
41
 
41
42
  # The database or source to authenticate the user against.
@@ -121,6 +122,10 @@ development:
121
122
  # existing method. (default: false)
122
123
  # scope_overwrite_exception: false
123
124
 
125
+ # Raise an error when defining a field with the same name as an
126
+ # existing method. (default: false)
127
+ # duplicate_fields_exception: false
128
+
124
129
  # Use Active Support's time zone in conversions. (default: true)
125
130
  # use_activesupport_time_zone: true
126
131
 
@@ -132,6 +137,11 @@ development:
132
137
  # otherwise.(default: :info)
133
138
  # log_level: :info
134
139
 
140
+ # Control whether `belongs_to` association is required. By default
141
+ # `belongs_to` will trigger a validation error if the association
142
+ # is not present. (default: true)
143
+ # belongs_to_required_by_default: true
144
+
135
145
  # Application name that is printed to the mongodb logs upon establishing a
136
146
  # connection in server versions >= 3.4. Note that the name cannot exceed 128 bytes.
137
147
  # app_name: MyApplicationName
@@ -1,6 +1,7 @@
1
1
  class Book
2
2
  include Mongoid::Document
3
3
  include Mongoid::Attributes::Dynamic
4
+ include Mongoid::Timestamps
4
5
  field :title, type: String
5
6
  field :chapters, type: Integer
6
7
  belongs_to :series
@@ -11,5 +12,5 @@ class Book
11
12
  doc.chapters = 5
12
13
  end
13
14
 
14
- embeds_many :pages
15
+ embeds_many :pages, cascade_callbacks: true
15
16
  end
@@ -3,7 +3,7 @@ class Page
3
3
  embedded_in :quiz
4
4
  embeds_many :page_questions
5
5
 
6
- embedded_in :book
6
+ embedded_in :book, touch: true
7
7
  embeds_many :notes
8
8
  field :content, :type => String
9
9
 
@@ -65,6 +65,21 @@ describe Mongoid::Contextual::None do
65
65
  end
66
66
  end
67
67
 
68
+ describe "#distinct" do
69
+
70
+ let!(:band) do
71
+ Band.create(name: "Depeche Mode")
72
+ end
73
+
74
+ let(:context) do
75
+ described_class.new(Band.where(name: "Depeche Mode"))
76
+ end
77
+
78
+ it "returns an empty array" do
79
+ expect(context.distinct(:id)).to eq([])
80
+ end
81
+ end
82
+
68
83
  describe "#pluck" do
69
84
 
70
85
  let!(:band) do
@@ -0,0 +1,89 @@
1
+ require "spec_helper"
2
+
3
+ describe Mongoid::Criteria::Queryable::Extensions::Regexp::Raw do
4
+
5
+ describe ".evolve" do
6
+
7
+ context "when provided a bson raw regexp" do
8
+
9
+ let(:regexp) do
10
+ BSON::Regexp::Raw.new("^[123]")
11
+ end
12
+
13
+ let(:evolved) do
14
+ BSON::Regexp::Raw.evolve(regexp)
15
+ end
16
+
17
+ it "returns the regexp" do
18
+ expect(evolved).to be(regexp)
19
+ end
20
+ end
21
+
22
+ context "when providing a string" do
23
+
24
+ let(:regexp_string) do
25
+ '^[123]'
26
+ end
27
+
28
+ let(:evolved) do
29
+ BSON::Regexp::Raw.evolve(regexp_string)
30
+ end
31
+
32
+ it "returns the converted raw regexp" do
33
+ expect(evolved).to eq(BSON::Regexp::Raw.new(regexp_string))
34
+ end
35
+ end
36
+
37
+ context "when provided an array" do
38
+
39
+ context "when the elements are bson raw regexps" do
40
+
41
+ let(:regexp) do
42
+ BSON::Regexp::Raw.new("^[123]")
43
+ end
44
+
45
+ let(:array) do
46
+ [ regexp ]
47
+ end
48
+
49
+ let(:evolved) do
50
+ BSON::Regexp::Raw.evolve(array)
51
+ end
52
+
53
+ it "returns the array containing raw regexps" do
54
+ expect(evolved).to eq([ regexp ])
55
+ end
56
+
57
+ it "does not evolve in place" do
58
+ expect(evolved).to_not equal(array)
59
+ end
60
+ end
61
+
62
+ context "when the elements are strings" do
63
+
64
+ let(:regexp_string) do
65
+ "^[123]"
66
+ end
67
+
68
+ let(:evolved) do
69
+ BSON::Regexp::Raw.evolve([ regexp_string ])
70
+ end
71
+
72
+ it "returns the regexps" do
73
+ expect(evolved).to eq([ BSON::Regexp::Raw.new(regexp_string) ])
74
+ end
75
+ end
76
+ end
77
+ end
78
+
79
+ describe "#regexp?" do
80
+
81
+ let(:regexp) do
82
+ BSON::Regexp::Raw.new('^[123]')
83
+ end
84
+
85
+ it "returns true" do
86
+ expect(regexp).to be_regexp
87
+ end
88
+ end
89
+ end
@@ -3469,6 +3469,21 @@ describe Mongoid::Criteria::Queryable::Selectable do
3469
3469
  expect(selection.selector).to eq({ "user_id" => document.id })
3470
3470
  end
3471
3471
  end
3472
+
3473
+ context 'when the field is a String and the value is a BSON::Regexp::Raw' do
3474
+
3475
+ let(:raw_regexp) do
3476
+ BSON::Regexp::Raw.new('^Em')
3477
+ end
3478
+
3479
+ let(:selection) do
3480
+ Login.where(_id: raw_regexp)
3481
+ end
3482
+
3483
+ it 'does not convert the bson raw regexp object to a String' do
3484
+ expect(selection.selector).to eq({ "_id" => raw_regexp })
3485
+ end
3486
+ end
3472
3487
  end
3473
3488
  end
3474
3489
 
@@ -412,7 +412,7 @@ describe Mongoid::Criteria do
412
412
  end
413
413
 
414
414
  let(:criteria) do
415
- Band.where(name: "Depeche Mode").asc(:name).includes(:records)
415
+ Band.where(name: "Depeche Mode").asc(:name).includes(:records).read(mode: :secondary)
416
416
  end
417
417
 
418
418
  before do
@@ -433,7 +433,7 @@ describe Mongoid::Criteria do
433
433
  end
434
434
 
435
435
  it "contains equal options" do
436
- expect(clone.options).to eq({ sort: { "name" => 1 }})
436
+ expect(clone.options).to eq({ sort: { "name" => 1 }, read: { mode: :secondary } })
437
437
  end
438
438
 
439
439
  it "clones the options" do
@@ -467,6 +467,10 @@ describe Mongoid::Criteria do
467
467
  it "sets the context to nil" do
468
468
  expect(clone.instance_variable_get(:@context)).to be_nil
469
469
  end
470
+
471
+ it 'does not convert the option keys to string from symbols' do
472
+ expect(clone.options[:read][:mode]).to eq(:secondary)
473
+ end
470
474
  end
471
475
  end
472
476
 
@@ -1152,6 +1152,25 @@ describe Mongoid::Interceptable do
1152
1152
  expect(band.reload.records.first.before_validation_called).to be true
1153
1153
  end
1154
1154
  end
1155
+
1156
+ context 'when the parent is updated' do
1157
+
1158
+ let(:band) do
1159
+ Band.create(name: "Moderat")
1160
+ end
1161
+
1162
+ before do
1163
+ band.update(records: [ { name: 'Black on Both Sides' }])
1164
+ end
1165
+
1166
+ it 'executes the callback' do
1167
+ expect(band.records.first.before_validation_called).to be true
1168
+ end
1169
+
1170
+ it 'persists the change' do
1171
+ expect(band.reload.records.first.before_validation_called).to be true
1172
+ end
1173
+ end
1155
1174
  end
1156
1175
 
1157
1176
  context "when the child is persisted" do
@@ -6,25 +6,25 @@ describe Mongoid::Matchable::All do
6
6
  described_class.new(["first", "second", "third"])
7
7
  end
8
8
 
9
- describe "#matches?" do
9
+ describe "#_matches?" do
10
10
 
11
11
  context "when the attribute includes all of the values" do
12
12
 
13
13
  it "returns true" do
14
- expect(matcher.matches?("$all" => ["first", /\Asec.*\z/])).to be true
14
+ expect(matcher._matches?("$all" => ["first", /\Asec.*\z/])).to be true
15
15
  end
16
16
  end
17
17
 
18
18
  context "when the attributes doesn't include all of the values" do
19
19
 
20
20
  it "returns false" do
21
- expect(matcher.matches?("$all" => ["second", "third", "fourth"])).to be false
21
+ expect(matcher._matches?("$all" => ["second", "third", "fourth"])).to be false
22
22
  end
23
23
  end
24
24
 
25
25
  context "when the value is empty" do
26
26
  it "returns false" do
27
- expect(matcher.matches?("$all" => [])).to be false
27
+ expect(matcher._matches?("$all" => [])).to be false
28
28
  end
29
29
  end
30
30
  end
@@ -10,7 +10,7 @@ describe Mongoid::Matchable::And do
10
10
  described_class.new("value", person)
11
11
  end
12
12
 
13
- describe "#matches?" do
13
+ describe "#_matches?" do
14
14
 
15
15
  context "when provided a simple expression" do
16
16
 
@@ -19,7 +19,7 @@ describe Mongoid::Matchable::And do
19
19
  context "when the value matches" do
20
20
 
21
21
  let(:matches) do
22
- matcher.matches?([ { title: "Sir" } ])
22
+ matcher._matches?([ { title: "Sir" } ])
23
23
  end
24
24
 
25
25
  before do
@@ -34,7 +34,7 @@ describe Mongoid::Matchable::And do
34
34
  context "when the expression is a $not" do
35
35
 
36
36
  let(:matches) do
37
- matcher.matches?([ { title: {:$not => /Foobar/ } }])
37
+ matcher._matches?([ { title: {:$not => /Foobar/ } }])
38
38
  end
39
39
 
40
40
  context "when the value matches" do
@@ -59,7 +59,7 @@ describe Mongoid::Matchable::And do
59
59
  context "when the value does not match" do
60
60
 
61
61
  let(:matches) do
62
- matcher.matches?([ { title: "Sir" } ])
62
+ matcher._matches?([ { title: "Sir" } ])
63
63
  end
64
64
 
65
65
  it "returns false" do
@@ -73,7 +73,7 @@ describe Mongoid::Matchable::And do
73
73
  context "when all of the values are equal" do
74
74
 
75
75
  let(:matches) do
76
- matcher.matches?(
76
+ matcher._matches?(
77
77
  [ { title: "Sir" }, { _id: person.id } ]
78
78
  )
79
79
  end
@@ -90,7 +90,7 @@ describe Mongoid::Matchable::And do
90
90
  context "when one of the values does not match" do
91
91
 
92
92
  let(:matches) do
93
- matcher.matches?(
93
+ matcher._matches?(
94
94
  [ { title: "Sir" }, { _id: BSON::ObjectId.new } ]
95
95
  )
96
96
  end
@@ -107,7 +107,7 @@ describe Mongoid::Matchable::And do
107
107
  context "when provided no expressions" do
108
108
 
109
109
  let(:matches) do
110
- matcher.matches?([])
110
+ matcher._matches?([])
111
111
  end
112
112
 
113
113
  it "returns true" do
@@ -122,7 +122,7 @@ describe Mongoid::Matchable::And do
122
122
  context "when all of the values are equal" do
123
123
 
124
124
  let(:matches) do
125
- matcher.matches?(
125
+ matcher._matches?(
126
126
  [
127
127
  { title: { "$in" => [ "Sir", "Madam" ] } },
128
128
  { _id: person.id }
@@ -142,7 +142,7 @@ describe Mongoid::Matchable::And do
142
142
  context "when one of the values does not match" do
143
143
 
144
144
  let(:matches) do
145
- matcher.matches?(
145
+ matcher._matches?(
146
146
  [
147
147
  { title: { "$in" => [ "Prince", "Madam" ] } },
148
148
  { _id: BSON::ObjectId.new }
@@ -164,7 +164,7 @@ describe Mongoid::Matchable::And do
164
164
  context "when all the expressions match" do
165
165
 
166
166
  let(:matches) do
167
- matcher.matches?(
167
+ matcher._matches?(
168
168
  [
169
169
  { title: "Sir", age: 23 },
170
170
  { _id: person.id }