mongoid 5.4.1 → 6.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +3 -3
- data/lib/config/locales/en.yml +19 -0
- data/lib/mongoid.rb +4 -4
- data/lib/mongoid/atomic.rb +2 -2
- data/lib/mongoid/atomic/modifiers.rb +8 -12
- data/lib/mongoid/attributes.rb +22 -21
- data/lib/mongoid/attributes/readonly.rb +22 -0
- data/lib/mongoid/cacheable.rb +36 -0
- data/lib/mongoid/changeable.rb +36 -0
- data/lib/mongoid/clients.rb +8 -63
- data/lib/mongoid/clients/options.rb +55 -250
- data/lib/mongoid/clients/storage_options.rb +1 -69
- data/lib/mongoid/composable.rb +29 -3
- data/lib/mongoid/config.rb +1 -0
- data/lib/mongoid/contextual/atomic.rb +5 -8
- data/lib/mongoid/contextual/map_reduce.rb +0 -4
- data/lib/mongoid/contextual/memory.rb +2 -2
- data/lib/mongoid/contextual/mongo.rb +40 -22
- data/lib/mongoid/contextual/none.rb +12 -0
- data/lib/mongoid/copyable.rb +13 -6
- data/lib/mongoid/criteria.rb +5 -2
- data/lib/mongoid/criteria/marshalable.rb +2 -2
- data/lib/mongoid/criteria/modifiable.rb +17 -1
- data/lib/mongoid/criteria/options.rb +25 -0
- data/lib/mongoid/criteria/queryable.rb +87 -0
- data/lib/mongoid/criteria/queryable/aggregable.rb +120 -0
- data/lib/mongoid/criteria/queryable/extensions.rb +28 -0
- data/lib/mongoid/criteria/queryable/extensions/array.rb +185 -0
- data/lib/mongoid/criteria/queryable/extensions/big_decimal.rb +37 -0
- data/lib/mongoid/criteria/queryable/extensions/boolean.rb +34 -0
- data/lib/mongoid/criteria/queryable/extensions/date.rb +63 -0
- data/lib/mongoid/criteria/queryable/extensions/date_time.rb +53 -0
- data/lib/mongoid/criteria/queryable/extensions/hash.rb +200 -0
- data/lib/mongoid/criteria/queryable/extensions/nil_class.rb +86 -0
- data/lib/mongoid/criteria/queryable/extensions/numeric.rb +90 -0
- data/lib/mongoid/criteria/queryable/extensions/object.rb +206 -0
- data/lib/mongoid/criteria/queryable/extensions/range.rb +70 -0
- data/lib/mongoid/criteria/queryable/extensions/regexp.rb +79 -0
- data/lib/mongoid/criteria/queryable/extensions/set.rb +34 -0
- data/lib/mongoid/criteria/queryable/extensions/string.rb +137 -0
- data/lib/mongoid/criteria/queryable/extensions/symbol.rb +79 -0
- data/lib/mongoid/criteria/queryable/extensions/time.rb +60 -0
- data/lib/mongoid/criteria/queryable/extensions/time_with_zone.rb +54 -0
- data/lib/mongoid/criteria/queryable/forwardable.rb +65 -0
- data/lib/mongoid/criteria/queryable/key.rb +103 -0
- data/lib/mongoid/criteria/queryable/macroable.rb +27 -0
- data/lib/mongoid/criteria/queryable/mergeable.rb +271 -0
- data/lib/mongoid/criteria/queryable/optional.rb +429 -0
- data/lib/mongoid/criteria/queryable/options.rb +153 -0
- data/lib/mongoid/criteria/queryable/pipeline.rb +111 -0
- data/lib/mongoid/criteria/queryable/selectable.rb +662 -0
- data/lib/mongoid/criteria/queryable/selector.rb +212 -0
- data/lib/mongoid/criteria/queryable/smash.rb +104 -0
- data/lib/mongoid/document.rb +30 -37
- data/lib/mongoid/errors.rb +2 -0
- data/lib/mongoid/errors/ambiguous_relationship.rb +1 -1
- data/lib/mongoid/errors/in_memory_collation_not_supported.rb +1 -1
- data/lib/mongoid/errors/invalid_field.rb +2 -2
- data/lib/mongoid/errors/invalid_persistence_option.rb +29 -0
- data/lib/mongoid/errors/invalid_relation.rb +66 -0
- data/lib/mongoid/evolvable.rb +1 -1
- data/lib/mongoid/extensions.rb +0 -4
- data/lib/mongoid/extensions/big_decimal.rb +17 -8
- data/lib/mongoid/extensions/date.rb +4 -1
- data/lib/mongoid/extensions/decimal128.rb +3 -3
- data/lib/mongoid/extensions/hash.rb +1 -0
- data/lib/mongoid/extensions/string.rb +4 -3
- data/lib/mongoid/extensions/time.rb +4 -1
- data/lib/mongoid/fields/validators/macro.rb +18 -0
- data/lib/mongoid/findable.rb +2 -2
- data/lib/mongoid/indexable.rb +15 -13
- data/lib/mongoid/interceptable.rb +5 -22
- data/lib/mongoid/matchable.rb +13 -7
- data/lib/mongoid/matchable/all.rb +2 -2
- data/lib/mongoid/matchable/and.rb +3 -3
- data/lib/mongoid/matchable/default.rb +2 -2
- data/lib/mongoid/matchable/elem_match.rb +28 -0
- data/lib/mongoid/matchable/exists.rb +2 -2
- data/lib/mongoid/matchable/gt.rb +4 -2
- data/lib/mongoid/matchable/gte.rb +4 -2
- data/lib/mongoid/matchable/in.rb +2 -2
- data/lib/mongoid/matchable/lt.rb +4 -2
- data/lib/mongoid/matchable/lte.rb +4 -2
- data/lib/mongoid/matchable/ne.rb +2 -2
- data/lib/mongoid/matchable/nin.rb +2 -2
- data/lib/mongoid/matchable/or.rb +3 -3
- data/lib/mongoid/matchable/regexp.rb +3 -3
- data/lib/mongoid/matchable/size.rb +2 -2
- data/lib/mongoid/persistable.rb +3 -5
- data/lib/mongoid/persistable/creatable.rb +2 -2
- data/lib/mongoid/persistable/deletable.rb +1 -1
- data/lib/mongoid/persistable/settable.rb +1 -1
- data/lib/mongoid/persistable/updatable.rb +5 -12
- data/lib/mongoid/persistable/upsertable.rb +1 -1
- data/lib/mongoid/persistence_context.rb +215 -0
- data/lib/mongoid/query_cache.rb +3 -6
- data/lib/mongoid/relations/accessors.rb +3 -0
- data/lib/mongoid/relations/auto_save.rb +12 -4
- data/lib/mongoid/relations/bindings/referenced/many_to_many.rb +4 -4
- data/lib/mongoid/relations/counter_cache.rb +15 -5
- data/lib/mongoid/relations/eager.rb +6 -11
- data/lib/mongoid/relations/eager/base.rb +3 -3
- data/lib/mongoid/relations/eager/has_and_belongs_to_many.rb +2 -2
- data/lib/mongoid/relations/eager/has_many.rb +1 -1
- data/lib/mongoid/relations/embedded/batchable.rb +12 -36
- data/lib/mongoid/relations/embedded/in.rb +13 -1
- data/lib/mongoid/relations/embedded/many.rb +28 -10
- data/lib/mongoid/relations/embedded/one.rb +14 -1
- data/lib/mongoid/relations/macros.rb +9 -1
- data/lib/mongoid/relations/metadata.rb +3 -3
- data/lib/mongoid/relations/options.rb +2 -2
- data/lib/mongoid/relations/proxy.rb +1 -31
- data/lib/mongoid/relations/referenced/in.rb +19 -10
- data/lib/mongoid/relations/referenced/many.rb +23 -17
- data/lib/mongoid/relations/referenced/many_to_many.rb +20 -13
- data/lib/mongoid/relations/referenced/one.rb +15 -1
- data/lib/mongoid/relations/synchronization.rb +11 -11
- data/lib/mongoid/relations/touchable.rb +6 -3
- data/lib/mongoid/reloadable.rb +1 -1
- data/lib/mongoid/serializable.rb +1 -1
- data/lib/mongoid/traversable.rb +1 -1
- data/lib/mongoid/validatable/uniqueness.rb +1 -2
- data/lib/mongoid/version.rb +1 -1
- data/lib/rails/generators/mongoid/config/templates/mongoid.yml +14 -3
- data/spec/app/models/album.rb +5 -1
- data/spec/app/models/artist.rb +21 -0
- data/spec/app/models/book.rb +2 -1
- data/spec/app/models/dokument.rb +1 -0
- data/spec/app/models/ordered_post.rb +5 -0
- data/spec/app/models/oscar.rb +1 -2
- data/spec/app/models/page.rb +1 -1
- data/spec/app/models/person.rb +3 -3
- data/spec/app/models/princess.rb +2 -0
- data/spec/app/models/record.rb +1 -0
- data/spec/app/models/subscription.rb +1 -0
- data/spec/app/models/thing.rb +1 -1
- data/spec/config/mongoid.yml +15 -0
- data/spec/mongoid/atomic/modifiers_spec.rb +17 -17
- data/spec/mongoid/atomic_spec.rb +17 -17
- data/spec/mongoid/attributes/nested_spec.rb +14 -14
- data/spec/mongoid/attributes/readonly_spec.rb +87 -44
- data/spec/mongoid/attributes_spec.rb +90 -5
- data/spec/mongoid/cacheable_spec.rb +112 -0
- data/spec/mongoid/changeable_spec.rb +58 -0
- data/spec/mongoid/clients/factory_spec.rb +31 -3
- data/spec/mongoid/clients/options_spec.rb +382 -96
- data/spec/mongoid/clients_spec.rb +243 -101
- data/spec/mongoid/composable_spec.rb +7 -0
- data/spec/mongoid/config_spec.rb +67 -11
- data/spec/mongoid/contextual/atomic_spec.rb +3 -3
- data/spec/mongoid/contextual/mongo_spec.rb +165 -20
- data/spec/mongoid/contextual/none_spec.rb +15 -0
- data/spec/mongoid/copyable_spec.rb +13 -4
- data/spec/mongoid/criteria/modifiable_spec.rb +239 -7
- data/spec/mongoid/criteria/options_spec.rb +29 -0
- data/spec/mongoid/criteria/queryable/aggregable_spec.rb +370 -0
- data/spec/mongoid/criteria/queryable/extensions/array_spec.rb +523 -0
- data/spec/mongoid/criteria/queryable/extensions/big_decimal_spec.rb +59 -0
- data/spec/mongoid/criteria/queryable/extensions/bignum_spec.rb +58 -0
- data/spec/mongoid/criteria/queryable/extensions/boolean_spec.rb +213 -0
- data/spec/mongoid/criteria/queryable/extensions/date_spec.rb +330 -0
- data/spec/mongoid/criteria/queryable/extensions/date_time_spec.rb +405 -0
- data/spec/mongoid/criteria/queryable/extensions/fixnum_spec.rb +58 -0
- data/spec/mongoid/criteria/queryable/extensions/float_spec.rb +65 -0
- data/spec/mongoid/criteria/queryable/extensions/hash_spec.rb +327 -0
- data/spec/mongoid/criteria/queryable/extensions/integer_spec.rb +65 -0
- data/spec/mongoid/criteria/queryable/extensions/nil_class_spec.rb +77 -0
- data/spec/mongoid/criteria/queryable/extensions/object_spec.rb +108 -0
- data/spec/mongoid/criteria/queryable/extensions/range_spec.rb +309 -0
- data/spec/mongoid/{extensions/origin → criteria/queryable/extensions}/regexp_raw_spec.rb +2 -2
- data/spec/mongoid/criteria/queryable/extensions/regexp_spec.rb +90 -0
- data/spec/mongoid/criteria/queryable/extensions/set_spec.rb +39 -0
- data/spec/mongoid/criteria/queryable/extensions/string_spec.rb +302 -0
- data/spec/mongoid/criteria/queryable/extensions/symbol_spec.rb +167 -0
- data/spec/mongoid/criteria/queryable/extensions/time_spec.rb +376 -0
- data/spec/mongoid/criteria/queryable/extensions/time_with_zone_spec.rb +347 -0
- data/spec/mongoid/criteria/queryable/forwardable_spec.rb +87 -0
- data/spec/mongoid/criteria/queryable/key_spec.rb +52 -0
- data/spec/mongoid/criteria/queryable/mergeable_spec.rb +49 -0
- data/spec/mongoid/criteria/queryable/optional_spec.rb +1799 -0
- data/spec/mongoid/criteria/queryable/options_spec.rb +360 -0
- data/spec/mongoid/criteria/queryable/pipeline_spec.rb +200 -0
- data/spec/mongoid/criteria/queryable/queryable_spec.rb +137 -0
- data/spec/mongoid/criteria/queryable/selectable_spec.rb +4174 -0
- data/spec/mongoid/criteria/queryable/selector_spec.rb +844 -0
- data/spec/mongoid/criteria/queryable/smash_spec.rb +30 -0
- data/spec/mongoid/criteria_spec.rb +152 -21
- data/spec/mongoid/document_spec.rb +37 -88
- data/spec/mongoid/errors/invalid_relation_spec.rb +37 -0
- data/spec/mongoid/errors/mongoid_error_spec.rb +6 -3
- data/spec/mongoid/extensions/big_decimal_spec.rb +320 -18
- data/spec/mongoid/extensions/boolean_spec.rb +14 -0
- data/spec/mongoid/extensions/date_spec.rb +2 -6
- data/spec/mongoid/extensions/date_time_spec.rb +2 -6
- data/spec/mongoid/extensions/decimal128_spec.rb +1 -1
- data/spec/mongoid/extensions/float_spec.rb +8 -1
- data/spec/mongoid/extensions/hash_spec.rb +15 -0
- data/spec/mongoid/extensions/integer_spec.rb +8 -1
- data/spec/mongoid/extensions/object_spec.rb +11 -0
- data/spec/mongoid/extensions/string_spec.rb +21 -0
- data/spec/mongoid/extensions/time_spec.rb +2 -6
- data/spec/mongoid/extensions/time_with_zone_spec.rb +2 -6
- data/spec/mongoid/findable_spec.rb +46 -1
- data/spec/mongoid/indexable_spec.rb +15 -3
- data/spec/mongoid/interceptable_spec.rb +68 -10
- data/spec/mongoid/matchable/all_spec.rb +4 -4
- data/spec/mongoid/matchable/and_spec.rb +10 -10
- data/spec/mongoid/matchable/default_spec.rb +12 -12
- data/spec/mongoid/matchable/elem_match_spec.rb +86 -0
- data/spec/mongoid/matchable/exists_spec.rb +5 -5
- data/spec/mongoid/matchable/gt_spec.rb +18 -7
- data/spec/mongoid/matchable/gte_spec.rb +17 -7
- data/spec/mongoid/matchable/in_spec.rb +5 -5
- data/spec/mongoid/matchable/lt_spec.rb +18 -7
- data/spec/mongoid/matchable/lte_spec.rb +18 -7
- data/spec/mongoid/matchable/ne_spec.rb +5 -5
- data/spec/mongoid/matchable/nin_spec.rb +5 -5
- data/spec/mongoid/matchable/or_spec.rb +7 -7
- data/spec/mongoid/matchable/regexp_spec.rb +5 -5
- data/spec/mongoid/matchable/size_spec.rb +3 -3
- data/spec/mongoid/matchable_spec.rb +173 -53
- data/spec/mongoid/persistable/creatable_spec.rb +7 -2
- data/spec/mongoid/persistable/deletable_spec.rb +16 -1
- data/spec/mongoid/persistable/destroyable_spec.rb +6 -2
- data/spec/mongoid/persistable/savable_spec.rb +35 -30
- data/spec/mongoid/persistable/settable_spec.rb +45 -29
- data/spec/mongoid/persistable/updatable_spec.rb +184 -5
- data/spec/mongoid/persistence_context_spec.rb +680 -0
- data/spec/mongoid/positional_spec.rb +10 -10
- data/spec/mongoid/query_cache_spec.rb +89 -0
- data/spec/mongoid/relations/accessors_spec.rb +1 -1
- data/spec/mongoid/relations/auto_save_spec.rb +39 -6
- data/spec/mongoid/relations/bindings/referenced/many_to_many_spec.rb +4 -4
- data/spec/mongoid/relations/builders_spec.rb +37 -10
- data/spec/mongoid/relations/counter_cache_spec.rb +64 -3
- data/spec/mongoid/relations/eager/has_and_belongs_to_many_spec.rb +16 -0
- data/spec/mongoid/relations/eager_spec.rb +40 -0
- data/spec/mongoid/relations/embedded/many_spec.rb +63 -47
- data/spec/mongoid/relations/embedded/one_spec.rb +2 -1
- data/spec/mongoid/relations/macros_spec.rb +395 -7
- data/spec/mongoid/relations/metadata_spec.rb +15 -1
- data/spec/mongoid/relations/proxy_spec.rb +27 -1
- data/spec/mongoid/relations/referenced/in_spec.rb +41 -1
- data/spec/mongoid/relations/referenced/many_spec.rb +13 -25
- data/spec/mongoid/relations/referenced/many_to_many_spec.rb +14 -26
- data/spec/mongoid/relations/synchronization_spec.rb +48 -2
- data/spec/mongoid/relations/touchable_spec.rb +40 -0
- data/spec/mongoid/reloadable_spec.rb +51 -0
- data/spec/mongoid/serializable_spec.rb +0 -50
- data/spec/mongoid/validatable/presence_spec.rb +1 -1
- data/spec/mongoid/validatable/uniqueness_spec.rb +18 -9
- data/spec/mongoid/validatable_spec.rb +16 -0
- data/spec/spec_helper.rb +20 -11
- metadata +524 -469
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/mongoid/clients/thread_options.rb +0 -19
- data/lib/mongoid/extensions/origin/regexp_raw.rb +0 -43
- metadata.gz.sig +0 -0
@@ -2,7 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe Mongoid::Matchable::In do
|
4
4
|
|
5
|
-
describe "#
|
5
|
+
describe "#_matches\?" do
|
6
6
|
|
7
7
|
context 'when the attribute is not nil' do
|
8
8
|
|
@@ -13,14 +13,14 @@ describe Mongoid::Matchable::In do
|
|
13
13
|
context "when the values include the attribute" do
|
14
14
|
|
15
15
|
it "returns true" do
|
16
|
-
expect(matcher.
|
16
|
+
expect(matcher._matches?("$in" => [/\Afir.*\z/, "second"])).to be true
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
20
|
context "when the values don't include the attribute" do
|
21
21
|
|
22
22
|
it "returns false" do
|
23
|
-
expect(matcher.
|
23
|
+
expect(matcher._matches?("$in" => ["third"])).to be false
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
@@ -34,14 +34,14 @@ describe Mongoid::Matchable::In do
|
|
34
34
|
context "when the values include the attribute" do
|
35
35
|
|
36
36
|
it "returns true" do
|
37
|
-
expect(matcher.
|
37
|
+
expect(matcher._matches?("$in" => [/\Afir.*\z/, nil])).to be true
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
41
|
context "when the values don't include the attribute" do
|
42
42
|
|
43
43
|
it "returns false" do
|
44
|
-
expect(matcher.
|
44
|
+
expect(matcher._matches?("$in" => ["third"])).to be false
|
45
45
|
end
|
46
46
|
end
|
47
47
|
end
|
@@ -2,7 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe Mongoid::Matchable::Lt do
|
4
4
|
|
5
|
-
describe "#
|
5
|
+
describe "#_matches\?" do
|
6
6
|
|
7
7
|
context "when the value is larger" do
|
8
8
|
|
@@ -11,7 +11,7 @@ describe Mongoid::Matchable::Lt do
|
|
11
11
|
end
|
12
12
|
|
13
13
|
it "returns false" do
|
14
|
-
expect(matcher.
|
14
|
+
expect(matcher._matches?("$lt" => 3)).to be false
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
@@ -22,7 +22,7 @@ describe Mongoid::Matchable::Lt do
|
|
22
22
|
end
|
23
23
|
|
24
24
|
it "returns false" do
|
25
|
-
expect(matcher.
|
25
|
+
expect(matcher._matches?("$lt" => 3)).to be false
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
@@ -33,7 +33,7 @@ describe Mongoid::Matchable::Lt do
|
|
33
33
|
end
|
34
34
|
|
35
35
|
it "returns true" do
|
36
|
-
expect(matcher.
|
36
|
+
expect(matcher._matches?("$lt" => 10)).to be true
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
@@ -44,7 +44,7 @@ describe Mongoid::Matchable::Lt do
|
|
44
44
|
end
|
45
45
|
|
46
46
|
it "returns false" do
|
47
|
-
expect(matcher.
|
47
|
+
expect(matcher._matches?("$lt" => 5)).to be false
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
@@ -55,7 +55,7 @@ describe Mongoid::Matchable::Lt do
|
|
55
55
|
end
|
56
56
|
|
57
57
|
it "returns true" do
|
58
|
-
expect(matcher.
|
58
|
+
expect(matcher._matches?("$lt" => 5)).to be true
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
@@ -65,10 +65,21 @@ describe Mongoid::Matchable::Lt do
|
|
65
65
|
end
|
66
66
|
|
67
67
|
it "returns false" do
|
68
|
-
expect(matcher.
|
68
|
+
expect(matcher._matches?("$lt" => 5)).to be false
|
69
69
|
end
|
70
70
|
|
71
71
|
end
|
72
72
|
end
|
73
|
+
|
74
|
+
context "when the value is not numeric" do
|
75
|
+
|
76
|
+
let(:matcher) do
|
77
|
+
described_class.new(5)
|
78
|
+
end
|
79
|
+
|
80
|
+
it "returns false" do
|
81
|
+
expect(matcher._matches?("$lt" => '5.1')).to be false
|
82
|
+
end
|
83
|
+
end
|
73
84
|
end
|
74
85
|
end
|
@@ -2,7 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe Mongoid::Matchable::Lte do
|
4
4
|
|
5
|
-
describe "#
|
5
|
+
describe "#_matches\?" do
|
6
6
|
|
7
7
|
context "when the value is larger" do
|
8
8
|
|
@@ -11,7 +11,7 @@ describe Mongoid::Matchable::Lte do
|
|
11
11
|
end
|
12
12
|
|
13
13
|
it "returns false" do
|
14
|
-
expect(matcher.
|
14
|
+
expect(matcher._matches?("$lte" => 3)).to be false
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
@@ -22,7 +22,7 @@ describe Mongoid::Matchable::Lte do
|
|
22
22
|
end
|
23
23
|
|
24
24
|
it "returns true" do
|
25
|
-
expect(matcher.
|
25
|
+
expect(matcher._matches?("$lte" => 10)).to be true
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
@@ -33,7 +33,7 @@ describe Mongoid::Matchable::Lte do
|
|
33
33
|
end
|
34
34
|
|
35
35
|
it "returns true" do
|
36
|
-
expect(matcher.
|
36
|
+
expect(matcher._matches?("$lte" => 5)).to be true
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
@@ -44,18 +44,19 @@ describe Mongoid::Matchable::Lte do
|
|
44
44
|
end
|
45
45
|
|
46
46
|
it "returns false" do
|
47
|
-
expect(matcher.
|
47
|
+
expect(matcher._matches?("$lte" => 5)).to be false
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
51
|
context "when the value is an array" do
|
52
|
+
|
52
53
|
context "there are value valid" do
|
53
54
|
let(:matcher) do
|
54
55
|
described_class.new([3, 4])
|
55
56
|
end
|
56
57
|
|
57
58
|
it "returns true" do
|
58
|
-
expect(matcher.
|
59
|
+
expect(matcher._matches?("$lte" => 5)).to be true
|
59
60
|
end
|
60
61
|
end
|
61
62
|
|
@@ -65,9 +66,19 @@ describe Mongoid::Matchable::Lte do
|
|
65
66
|
end
|
66
67
|
|
67
68
|
it "returns false" do
|
68
|
-
expect(matcher.
|
69
|
+
expect(matcher._matches?("$lte" => 5)).to be false
|
69
70
|
end
|
71
|
+
end
|
72
|
+
end
|
70
73
|
|
74
|
+
context "when the value is not numeric" do
|
75
|
+
|
76
|
+
let(:matcher) do
|
77
|
+
described_class.new(5)
|
78
|
+
end
|
79
|
+
|
80
|
+
it "returns false" do
|
81
|
+
expect(matcher._matches?("$lte" => '5.1')).to be false
|
71
82
|
end
|
72
83
|
end
|
73
84
|
end
|
@@ -6,19 +6,19 @@ describe Mongoid::Matchable::Ne do
|
|
6
6
|
described_class.new("first")
|
7
7
|
end
|
8
8
|
|
9
|
-
describe "#
|
9
|
+
describe "#_matches?" do
|
10
10
|
|
11
11
|
context "when the values are not equal" do
|
12
12
|
|
13
13
|
it "returns true" do
|
14
|
-
expect(matcher.
|
14
|
+
expect(matcher._matches?("$ne" => "second")).to be true
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
18
|
context "when the values are equal" do
|
19
19
|
|
20
20
|
it "returns false" do
|
21
|
-
expect(matcher.
|
21
|
+
expect(matcher._matches?("$ne" => "first")).to be false
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
@@ -31,14 +31,14 @@ describe Mongoid::Matchable::Ne do
|
|
31
31
|
context "when the value is in the array" do
|
32
32
|
|
33
33
|
it "returns false" do
|
34
|
-
expect(array_matcher.
|
34
|
+
expect(array_matcher._matches?("$ne" => "first")).to be false
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
38
|
context "when the value is not in the array" do
|
39
39
|
|
40
40
|
it "returns true" do
|
41
|
-
expect(array_matcher.
|
41
|
+
expect(array_matcher._matches?("$ne" => "second")).to be true
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
@@ -2,7 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe Mongoid::Matchable::Nin do
|
4
4
|
|
5
|
-
describe "#
|
5
|
+
describe "#_matches?" do
|
6
6
|
|
7
7
|
context 'when the attribute is not nil' do
|
8
8
|
|
@@ -13,14 +13,14 @@ describe Mongoid::Matchable::Nin do
|
|
13
13
|
context "when the values do not contain the attribute" do
|
14
14
|
|
15
15
|
it "returns true" do
|
16
|
-
expect(matcher.
|
16
|
+
expect(matcher._matches?("$nin" => ["second", "third"])).to be true
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
20
|
context "when the values contain the attribute" do
|
21
21
|
|
22
22
|
it "returns false" do
|
23
|
-
expect(matcher.
|
23
|
+
expect(matcher._matches?("$nin" => ["first"])).to be false
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
@@ -33,14 +33,14 @@ describe Mongoid::Matchable::Nin do
|
|
33
33
|
context "when the values do not contain the attribute" do
|
34
34
|
|
35
35
|
it "returns true" do
|
36
|
-
expect(matcher.
|
36
|
+
expect(matcher._matches?("$nin" => ["third"])).to be true
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
40
|
context "when the values contain the attribute" do
|
41
41
|
|
42
42
|
it "returns false" do
|
43
|
-
expect(matcher.
|
43
|
+
expect(matcher._matches?("$nin" => [/\Afir.*\z/, nil])).to be false
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
@@ -10,14 +10,14 @@ describe Mongoid::Matchable::Or do
|
|
10
10
|
described_class.new("value", person)
|
11
11
|
end
|
12
12
|
|
13
|
-
describe "#
|
13
|
+
describe "#_matches?" do
|
14
14
|
|
15
15
|
context "when provided a simple expression" do
|
16
16
|
|
17
17
|
context "when any of the values are equal" do
|
18
18
|
|
19
19
|
let(:matches) do
|
20
|
-
matcher.
|
20
|
+
matcher._matches?(
|
21
21
|
[ { title: "Sir" }, { title: "King" } ]
|
22
22
|
)
|
23
23
|
end
|
@@ -34,14 +34,14 @@ describe Mongoid::Matchable::Or do
|
|
34
34
|
context "when none of the values are equal" do
|
35
35
|
|
36
36
|
it "returns false" do
|
37
|
-
expect(matcher.
|
37
|
+
expect(matcher._matches?([])).to be false
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
41
|
context "when the expression is a $not" do
|
42
42
|
|
43
43
|
let(:matches) do
|
44
|
-
matcher.
|
44
|
+
matcher._matches?([ { title: {:$not => /Foobar/ } }])
|
45
45
|
end
|
46
46
|
|
47
47
|
context "when the value matches" do
|
@@ -69,7 +69,7 @@ describe Mongoid::Matchable::Or do
|
|
69
69
|
context "when any of the values are equal" do
|
70
70
|
|
71
71
|
let(:matches) do
|
72
|
-
matcher.
|
72
|
+
matcher._matches?(
|
73
73
|
[
|
74
74
|
{ title: { "$in" => [ "Sir", "Madam" ] } },
|
75
75
|
{ title: "King" }
|
@@ -89,7 +89,7 @@ describe Mongoid::Matchable::Or do
|
|
89
89
|
context "when none of the values are equal" do
|
90
90
|
|
91
91
|
let(:matches) do
|
92
|
-
matcher.
|
92
|
+
matcher._matches?(
|
93
93
|
[
|
94
94
|
{ title: { "$in" => [ "Prince", "Madam" ] } },
|
95
95
|
{ title: "King" }
|
@@ -109,7 +109,7 @@ describe Mongoid::Matchable::Or do
|
|
109
109
|
context "when expression contain multiple fields" do
|
110
110
|
|
111
111
|
let(:matches) do
|
112
|
-
matcher.
|
112
|
+
matcher._matches?(
|
113
113
|
[
|
114
114
|
{ title: "Sir", age: 23 },
|
115
115
|
{ title: "King", age: 100 }
|
@@ -10,7 +10,7 @@ describe Mongoid::Matchable::Regexp do
|
|
10
10
|
'Emily'
|
11
11
|
end
|
12
12
|
|
13
|
-
describe '#
|
13
|
+
describe '#_matches?' do
|
14
14
|
|
15
15
|
context 'when a BSON::Regexp::Raw object is passed' do
|
16
16
|
|
@@ -19,7 +19,7 @@ describe Mongoid::Matchable::Regexp do
|
|
19
19
|
end
|
20
20
|
|
21
21
|
it 'compiles the regexp object to a native regexp for the matching' do
|
22
|
-
expect(matcher.
|
22
|
+
expect(matcher._matches?(regexp)).to be(true)
|
23
23
|
end
|
24
24
|
|
25
25
|
context 'when the value does not match the attribute' do
|
@@ -29,7 +29,7 @@ describe Mongoid::Matchable::Regexp do
|
|
29
29
|
end
|
30
30
|
|
31
31
|
it 'compiles the regexp object to a native regexp for the matching' do
|
32
|
-
expect(matcher.
|
32
|
+
expect(matcher._matches?(regexp)).to be(false)
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
@@ -41,7 +41,7 @@ describe Mongoid::Matchable::Regexp do
|
|
41
41
|
end
|
42
42
|
|
43
43
|
it 'calls super with the native regexp' do
|
44
|
-
expect(matcher.
|
44
|
+
expect(matcher._matches?(regexp)).to be(true)
|
45
45
|
end
|
46
46
|
|
47
47
|
context 'when the value does not match the attribute' do
|
@@ -51,7 +51,7 @@ describe Mongoid::Matchable::Regexp do
|
|
51
51
|
end
|
52
52
|
|
53
53
|
it 'compiles the regexp object to a native regexp for the matching' do
|
54
|
-
expect(matcher.
|
54
|
+
expect(matcher._matches?(regexp)).to be(false)
|
55
55
|
end
|
56
56
|
end
|
57
57
|
end
|
@@ -6,19 +6,19 @@ describe Mongoid::Matchable::Size do
|
|
6
6
|
described_class.new(["first", "second"])
|
7
7
|
end
|
8
8
|
|
9
|
-
describe "#
|
9
|
+
describe "#_matches?" do
|
10
10
|
|
11
11
|
context "when the attribute is the same size" do
|
12
12
|
|
13
13
|
it "returns true" do
|
14
|
-
expect(matcher.
|
14
|
+
expect(matcher._matches?("$size" => 2)).to be true
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
18
|
context "when the attribute is not the same size" do
|
19
19
|
|
20
20
|
it "returns false" do
|
21
|
-
expect(matcher.
|
21
|
+
expect(matcher._matches?("$size" => 5)).to be false
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
@@ -2,7 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe Mongoid::Matchable do
|
4
4
|
|
5
|
-
describe "#
|
5
|
+
describe "#_matches?" do
|
6
6
|
|
7
7
|
context "when document is embeded" do
|
8
8
|
|
@@ -26,7 +26,7 @@ describe Mongoid::Matchable do
|
|
26
26
|
end
|
27
27
|
|
28
28
|
it "returns false" do
|
29
|
-
expect(document.locations.first.
|
29
|
+
expect(document.locations.first._matches?(selector)).to be false
|
30
30
|
end
|
31
31
|
|
32
32
|
context "when just change the selector order" do
|
@@ -36,7 +36,7 @@ describe Mongoid::Matchable do
|
|
36
36
|
end
|
37
37
|
|
38
38
|
it "returns false " do
|
39
|
-
expect(document.locations.first.
|
39
|
+
expect(document.locations.first._matches?(selector)).to be false
|
40
40
|
end
|
41
41
|
end
|
42
42
|
end
|
@@ -50,7 +50,7 @@ describe Mongoid::Matchable do
|
|
50
50
|
end
|
51
51
|
|
52
52
|
it "returns true" do
|
53
|
-
expect(document.locations.first.
|
53
|
+
expect(document.locations.first._matches?(selector)).to be true
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
@@ -61,7 +61,7 @@ describe Mongoid::Matchable do
|
|
61
61
|
end
|
62
62
|
|
63
63
|
it "returns false" do
|
64
|
-
expect(document.locations.first.
|
64
|
+
expect(document.locations.first._matches?(selector)).to be false
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
@@ -72,7 +72,7 @@ describe Mongoid::Matchable do
|
|
72
72
|
end
|
73
73
|
|
74
74
|
it "returns false" do
|
75
|
-
expect(document.locations.first.
|
75
|
+
expect(document.locations.first._matches?(selector)).to be false
|
76
76
|
end
|
77
77
|
end
|
78
78
|
end
|
@@ -88,7 +88,7 @@ describe Mongoid::Matchable do
|
|
88
88
|
end
|
89
89
|
|
90
90
|
it "returns true" do
|
91
|
-
expect(document.locations.first.
|
91
|
+
expect(document.locations.first._matches?(selector)).to be true
|
92
92
|
end
|
93
93
|
end
|
94
94
|
|
@@ -99,7 +99,7 @@ describe Mongoid::Matchable do
|
|
99
99
|
end
|
100
100
|
|
101
101
|
it "returns false" do
|
102
|
-
expect(document.locations.first.
|
102
|
+
expect(document.locations.first._matches?(selector)).to be false
|
103
103
|
end
|
104
104
|
end
|
105
105
|
end
|
@@ -113,7 +113,7 @@ describe Mongoid::Matchable do
|
|
113
113
|
end
|
114
114
|
|
115
115
|
it "returns true" do
|
116
|
-
expect(document.locations.first.
|
116
|
+
expect(document.locations.first._matches?(selector)).to be true
|
117
117
|
end
|
118
118
|
end
|
119
119
|
|
@@ -124,7 +124,7 @@ describe Mongoid::Matchable do
|
|
124
124
|
end
|
125
125
|
|
126
126
|
it "returns false" do
|
127
|
-
expect(document.locations.first.
|
127
|
+
expect(document.locations.first._matches?(selector)).to be false
|
128
128
|
end
|
129
129
|
end
|
130
130
|
|
@@ -135,11 +135,131 @@ describe Mongoid::Matchable do
|
|
135
135
|
end
|
136
136
|
|
137
137
|
it "returns false" do
|
138
|
-
expect(document.locations.first.
|
138
|
+
expect(document.locations.first._matches?(selector)).to be false
|
139
139
|
end
|
140
140
|
end
|
141
141
|
end
|
142
142
|
|
143
|
+
context "when using $elemMatch" do
|
144
|
+
|
145
|
+
context "one predicate" do
|
146
|
+
|
147
|
+
let(:selector) do
|
148
|
+
{
|
149
|
+
"occupants" => {"$elemMatch" => {"name" => "Tim"}}
|
150
|
+
}
|
151
|
+
end
|
152
|
+
|
153
|
+
context "and there is a matching sub document" do
|
154
|
+
|
155
|
+
it "returns true" do
|
156
|
+
expect(document.locations.first._matches?(selector)).to be true
|
157
|
+
end
|
158
|
+
|
159
|
+
context "using $in" do
|
160
|
+
let(:selector) do
|
161
|
+
{
|
162
|
+
"occupants" => {"$elemMatch" => {"name" => {"$in" => ["Tim", "Alice"]}}}
|
163
|
+
}
|
164
|
+
end
|
165
|
+
|
166
|
+
it "returns true" do
|
167
|
+
expect(document.locations.first._matches?(selector)).to be true
|
168
|
+
end
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
context "and there is not a matching sub document" do
|
173
|
+
|
174
|
+
let(:selector) do
|
175
|
+
{
|
176
|
+
"occupants" => {"$elemMatch" => {"name" => "Lyle"}}
|
177
|
+
}
|
178
|
+
end
|
179
|
+
|
180
|
+
it "returns false" do
|
181
|
+
expect(document.locations.first._matches?(selector)).to be false
|
182
|
+
end
|
183
|
+
|
184
|
+
context "using $in" do
|
185
|
+
let(:selector) do
|
186
|
+
{
|
187
|
+
"occupants" => {"$elemMatch" => {"name" => {"$in" => ["Lyfe", "Alice"]}}}
|
188
|
+
}
|
189
|
+
end
|
190
|
+
|
191
|
+
it "returns false" do
|
192
|
+
expect(document.locations.first._matches?(selector)).to be false
|
193
|
+
end
|
194
|
+
end
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
context "multiple predicates" do
|
199
|
+
|
200
|
+
before do
|
201
|
+
document.locations = [
|
202
|
+
Location.new(
|
203
|
+
name: 'No.1',
|
204
|
+
info: { 'door' => 'Red'},
|
205
|
+
occupants: [{'name' => 'Tim', 'eye_color' => 'brown'}, {'name' => 'Alice', 'eye_color' => 'blue'}]
|
206
|
+
)
|
207
|
+
]
|
208
|
+
end
|
209
|
+
|
210
|
+
let(:selector) do
|
211
|
+
{
|
212
|
+
"occupants" => {"$elemMatch" => {"name" => "Tim", "eye_color" => "brown"}}
|
213
|
+
}
|
214
|
+
end
|
215
|
+
|
216
|
+
context "and there is a matching sub document" do
|
217
|
+
|
218
|
+
it "returns true" do
|
219
|
+
expect(document.locations.first._matches?(selector)).to be true
|
220
|
+
end
|
221
|
+
|
222
|
+
context "using $in and $ne in the $elemMatch to include the element" do
|
223
|
+
|
224
|
+
let(:selector) do
|
225
|
+
{
|
226
|
+
"occupants" => {"$elemMatch" => {"name" => {"$in" => ["Tim"]}, "eye_color" => {"$ne" => "blue"}}}
|
227
|
+
}
|
228
|
+
end
|
229
|
+
|
230
|
+
it "returns true" do
|
231
|
+
expect(document.locations.first._matches?(selector)).to be true
|
232
|
+
end
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
236
|
+
context "and there is not a matching sub document" do
|
237
|
+
|
238
|
+
let(:selector) do
|
239
|
+
{
|
240
|
+
"occupants" => {"$elemMatch" => {"name" => "Tim", "eye_color" => "blue"}}
|
241
|
+
}
|
242
|
+
end
|
243
|
+
|
244
|
+
it "returns false" do
|
245
|
+
expect(document.locations.first._matches?(selector)).to be false
|
246
|
+
end
|
247
|
+
|
248
|
+
context "using $ne in the $elemMatch to exclude the element" do
|
249
|
+
|
250
|
+
let(:selector) do
|
251
|
+
{
|
252
|
+
"occupants" => {"$elemMatch" => {"name" => {"$in" => ["Tim"]}, "eye_color" => {"$ne" => "brown"}}}
|
253
|
+
}
|
254
|
+
end
|
255
|
+
|
256
|
+
it "returns false" do
|
257
|
+
expect(document.locations.first._matches?(selector)).to be false
|
258
|
+
end
|
259
|
+
end
|
260
|
+
end
|
261
|
+
end
|
262
|
+
end
|
143
263
|
end
|
144
264
|
|
145
265
|
context "when performing simple matching" do
|
@@ -155,7 +275,7 @@ describe Mongoid::Matchable do
|
|
155
275
|
end
|
156
276
|
|
157
277
|
it "returns true" do
|
158
|
-
expect(document.
|
278
|
+
expect(document._matches?(selector)).to be true
|
159
279
|
end
|
160
280
|
end
|
161
281
|
|
@@ -166,7 +286,7 @@ describe Mongoid::Matchable do
|
|
166
286
|
end
|
167
287
|
|
168
288
|
it "returns false" do
|
169
|
-
expect(document.
|
289
|
+
expect(document._matches?(selector)).to be false
|
170
290
|
end
|
171
291
|
end
|
172
292
|
|
@@ -177,7 +297,7 @@ describe Mongoid::Matchable do
|
|
177
297
|
end
|
178
298
|
|
179
299
|
it "returns true" do
|
180
|
-
expect(document.
|
300
|
+
expect(document._matches?(selector)).to be true
|
181
301
|
end
|
182
302
|
end
|
183
303
|
|
@@ -188,7 +308,7 @@ describe Mongoid::Matchable do
|
|
188
308
|
end
|
189
309
|
|
190
310
|
it "returns true" do
|
191
|
-
expect(document.
|
311
|
+
expect(document._matches?(selector)).to be true
|
192
312
|
end
|
193
313
|
end
|
194
314
|
end
|
@@ -213,7 +333,7 @@ describe Mongoid::Matchable do
|
|
213
333
|
end
|
214
334
|
|
215
335
|
it "returns true" do
|
216
|
-
expect(document.
|
336
|
+
expect(document._matches?(selector)).to be true
|
217
337
|
end
|
218
338
|
end
|
219
339
|
|
@@ -224,7 +344,7 @@ describe Mongoid::Matchable do
|
|
224
344
|
end
|
225
345
|
|
226
346
|
it "returns false" do
|
227
|
-
expect(document.
|
347
|
+
expect(document._matches?(selector)).to be false
|
228
348
|
end
|
229
349
|
end
|
230
350
|
end
|
@@ -238,7 +358,7 @@ describe Mongoid::Matchable do
|
|
238
358
|
end
|
239
359
|
|
240
360
|
it "returns true" do
|
241
|
-
expect(document.
|
361
|
+
expect(document._matches?(selector)).to be true
|
242
362
|
end
|
243
363
|
end
|
244
364
|
|
@@ -249,7 +369,7 @@ describe Mongoid::Matchable do
|
|
249
369
|
end
|
250
370
|
|
251
371
|
it "returns false" do
|
252
|
-
expect(document.
|
372
|
+
expect(document._matches?(selector)).to be false
|
253
373
|
end
|
254
374
|
end
|
255
375
|
end
|
@@ -263,7 +383,7 @@ describe Mongoid::Matchable do
|
|
263
383
|
end
|
264
384
|
|
265
385
|
it "returns true" do
|
266
|
-
expect(document.
|
386
|
+
expect(document._matches?(selector)).to be true
|
267
387
|
end
|
268
388
|
end
|
269
389
|
|
@@ -274,7 +394,7 @@ describe Mongoid::Matchable do
|
|
274
394
|
end
|
275
395
|
|
276
396
|
it "returns false" do
|
277
|
-
expect(document.
|
397
|
+
expect(document._matches?(selector)).to be false
|
278
398
|
end
|
279
399
|
end
|
280
400
|
end
|
@@ -288,7 +408,7 @@ describe Mongoid::Matchable do
|
|
288
408
|
end
|
289
409
|
|
290
410
|
it "returns true" do
|
291
|
-
expect(document.
|
411
|
+
expect(document._matches?(selector)).to be true
|
292
412
|
end
|
293
413
|
end
|
294
414
|
|
@@ -299,7 +419,7 @@ describe Mongoid::Matchable do
|
|
299
419
|
end
|
300
420
|
|
301
421
|
it "returns false" do
|
302
|
-
expect(document.
|
422
|
+
expect(document._matches?(selector)).to be false
|
303
423
|
end
|
304
424
|
end
|
305
425
|
end
|
@@ -313,7 +433,7 @@ describe Mongoid::Matchable do
|
|
313
433
|
end
|
314
434
|
|
315
435
|
it "returns true" do
|
316
|
-
expect(document.
|
436
|
+
expect(document._matches?(selector)).to be true
|
317
437
|
end
|
318
438
|
end
|
319
439
|
|
@@ -324,7 +444,7 @@ describe Mongoid::Matchable do
|
|
324
444
|
end
|
325
445
|
|
326
446
|
it "returns false" do
|
327
|
-
expect(document.
|
447
|
+
expect(document._matches?(selector)).to be false
|
328
448
|
end
|
329
449
|
end
|
330
450
|
end
|
@@ -338,7 +458,7 @@ describe Mongoid::Matchable do
|
|
338
458
|
end
|
339
459
|
|
340
460
|
it "returns true" do
|
341
|
-
expect(document.
|
461
|
+
expect(document._matches?(selector)).to be true
|
342
462
|
end
|
343
463
|
end
|
344
464
|
|
@@ -349,7 +469,7 @@ describe Mongoid::Matchable do
|
|
349
469
|
end
|
350
470
|
|
351
471
|
it "returns false" do
|
352
|
-
expect(document.
|
472
|
+
expect(document._matches?(selector)).to be false
|
353
473
|
end
|
354
474
|
end
|
355
475
|
end
|
@@ -367,7 +487,7 @@ describe Mongoid::Matchable do
|
|
367
487
|
end
|
368
488
|
|
369
489
|
it "returns true" do
|
370
|
-
expect(document.
|
490
|
+
expect(document._matches?(selector)).to be true
|
371
491
|
end
|
372
492
|
end
|
373
493
|
|
@@ -380,7 +500,7 @@ describe Mongoid::Matchable do
|
|
380
500
|
end
|
381
501
|
|
382
502
|
it "returns false" do
|
383
|
-
expect(document.
|
503
|
+
expect(document._matches?(selector)).to be false
|
384
504
|
end
|
385
505
|
end
|
386
506
|
end
|
@@ -400,7 +520,7 @@ describe Mongoid::Matchable do
|
|
400
520
|
end
|
401
521
|
|
402
522
|
it "returns true" do
|
403
|
-
expect(document.
|
523
|
+
expect(document._matches?(selector)).to be true
|
404
524
|
end
|
405
525
|
end
|
406
526
|
|
@@ -413,7 +533,7 @@ describe Mongoid::Matchable do
|
|
413
533
|
end
|
414
534
|
|
415
535
|
it "returns false" do
|
416
|
-
expect(document.
|
536
|
+
expect(document._matches?(selector)).to be false
|
417
537
|
end
|
418
538
|
end
|
419
539
|
end
|
@@ -429,7 +549,7 @@ describe Mongoid::Matchable do
|
|
429
549
|
end
|
430
550
|
|
431
551
|
it "returns true" do
|
432
|
-
expect(document.
|
552
|
+
expect(document._matches?(selector)).to be true
|
433
553
|
end
|
434
554
|
end
|
435
555
|
|
@@ -442,7 +562,7 @@ describe Mongoid::Matchable do
|
|
442
562
|
end
|
443
563
|
|
444
564
|
it "returns false" do
|
445
|
-
expect(document.
|
565
|
+
expect(document._matches?(selector)).to be false
|
446
566
|
end
|
447
567
|
end
|
448
568
|
end
|
@@ -460,7 +580,7 @@ describe Mongoid::Matchable do
|
|
460
580
|
end
|
461
581
|
|
462
582
|
it "returns true" do
|
463
|
-
expect(document.
|
583
|
+
expect(document._matches?(selector)).to be true
|
464
584
|
end
|
465
585
|
end
|
466
586
|
|
@@ -473,7 +593,7 @@ describe Mongoid::Matchable do
|
|
473
593
|
end
|
474
594
|
|
475
595
|
it "returns false" do
|
476
|
-
expect(document.
|
596
|
+
expect(document._matches?(selector)).to be false
|
477
597
|
end
|
478
598
|
end
|
479
599
|
end
|
@@ -488,7 +608,7 @@ describe Mongoid::Matchable do
|
|
488
608
|
end
|
489
609
|
|
490
610
|
it "returns true" do
|
491
|
-
expect(document.
|
611
|
+
expect(document._matches?(selector)).to be true
|
492
612
|
end
|
493
613
|
end
|
494
614
|
|
@@ -499,7 +619,7 @@ describe Mongoid::Matchable do
|
|
499
619
|
end
|
500
620
|
|
501
621
|
it "returns false" do
|
502
|
-
expect(document.
|
622
|
+
expect(document._matches?(selector)).to be false
|
503
623
|
end
|
504
624
|
end
|
505
625
|
end
|
@@ -513,7 +633,7 @@ describe Mongoid::Matchable do
|
|
513
633
|
end
|
514
634
|
|
515
635
|
it "returns true" do
|
516
|
-
expect(document.
|
636
|
+
expect(document._matches?(selector)).to be true
|
517
637
|
end
|
518
638
|
end
|
519
639
|
|
@@ -524,7 +644,7 @@ describe Mongoid::Matchable do
|
|
524
644
|
end
|
525
645
|
|
526
646
|
it "returns false" do
|
527
|
-
expect(document.
|
647
|
+
expect(document._matches?(selector)).to be false
|
528
648
|
end
|
529
649
|
end
|
530
650
|
end
|
@@ -538,7 +658,7 @@ describe Mongoid::Matchable do
|
|
538
658
|
end
|
539
659
|
|
540
660
|
it "returns true" do
|
541
|
-
expect(document.
|
661
|
+
expect(document._matches?(selector)).to be true
|
542
662
|
end
|
543
663
|
end
|
544
664
|
|
@@ -549,7 +669,7 @@ describe Mongoid::Matchable do
|
|
549
669
|
end
|
550
670
|
|
551
671
|
it "returns false" do
|
552
|
-
expect(document.
|
672
|
+
expect(document._matches?(selector)).to be false
|
553
673
|
end
|
554
674
|
end
|
555
675
|
end
|
@@ -563,7 +683,7 @@ describe Mongoid::Matchable do
|
|
563
683
|
end
|
564
684
|
|
565
685
|
it "returns true" do
|
566
|
-
expect(document.
|
686
|
+
expect(document._matches?(selector)).to be true
|
567
687
|
end
|
568
688
|
end
|
569
689
|
|
@@ -574,7 +694,7 @@ describe Mongoid::Matchable do
|
|
574
694
|
end
|
575
695
|
|
576
696
|
it "returns false" do
|
577
|
-
expect(document.
|
697
|
+
expect(document._matches?(selector)).to be false
|
578
698
|
end
|
579
699
|
end
|
580
700
|
end
|
@@ -588,7 +708,7 @@ describe Mongoid::Matchable do
|
|
588
708
|
end
|
589
709
|
|
590
710
|
it "returns true" do
|
591
|
-
expect(document.
|
711
|
+
expect(document._matches?(selector)).to be true
|
592
712
|
end
|
593
713
|
end
|
594
714
|
|
@@ -599,7 +719,7 @@ describe Mongoid::Matchable do
|
|
599
719
|
end
|
600
720
|
|
601
721
|
it "returns false" do
|
602
|
-
expect(document.
|
722
|
+
expect(document._matches?(selector)).to be false
|
603
723
|
end
|
604
724
|
end
|
605
725
|
end
|
@@ -613,7 +733,7 @@ describe Mongoid::Matchable do
|
|
613
733
|
end
|
614
734
|
|
615
735
|
it "returns true" do
|
616
|
-
expect(document.
|
736
|
+
expect(document._matches?(selector)).to be true
|
617
737
|
end
|
618
738
|
end
|
619
739
|
|
@@ -624,7 +744,7 @@ describe Mongoid::Matchable do
|
|
624
744
|
end
|
625
745
|
|
626
746
|
it "returns false" do
|
627
|
-
expect(document.
|
747
|
+
expect(document._matches?(selector)).to be false
|
628
748
|
end
|
629
749
|
end
|
630
750
|
end
|
@@ -638,7 +758,7 @@ describe Mongoid::Matchable do
|
|
638
758
|
end
|
639
759
|
|
640
760
|
it "returns true" do
|
641
|
-
expect(document.
|
761
|
+
expect(document._matches?(selector)).to be true
|
642
762
|
end
|
643
763
|
end
|
644
764
|
|
@@ -649,7 +769,7 @@ describe Mongoid::Matchable do
|
|
649
769
|
end
|
650
770
|
|
651
771
|
it "returns false" do
|
652
|
-
expect(document.
|
772
|
+
expect(document._matches?(selector)).to be false
|
653
773
|
end
|
654
774
|
end
|
655
775
|
end
|
@@ -663,7 +783,7 @@ describe Mongoid::Matchable do
|
|
663
783
|
end
|
664
784
|
|
665
785
|
it "returns true" do
|
666
|
-
expect(document.
|
786
|
+
expect(document._matches?(selector)).to be true
|
667
787
|
end
|
668
788
|
end
|
669
789
|
|
@@ -674,7 +794,7 @@ describe Mongoid::Matchable do
|
|
674
794
|
end
|
675
795
|
|
676
796
|
it "returns false" do
|
677
|
-
expect(document.
|
797
|
+
expect(document._matches?(selector)).to be false
|
678
798
|
end
|
679
799
|
end
|
680
800
|
end
|
@@ -688,7 +808,7 @@ describe Mongoid::Matchable do
|
|
688
808
|
end
|
689
809
|
|
690
810
|
it "returns true" do
|
691
|
-
expect(document.
|
811
|
+
expect(document._matches?(selector)).to be true
|
692
812
|
end
|
693
813
|
end
|
694
814
|
|
@@ -699,7 +819,7 @@ describe Mongoid::Matchable do
|
|
699
819
|
end
|
700
820
|
|
701
821
|
it "returns false" do
|
702
|
-
expect(document.
|
822
|
+
expect(document._matches?(selector)).to be false
|
703
823
|
end
|
704
824
|
end
|
705
825
|
end
|