mongoid 7.5.0 → 7.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 32597c6d6b536f273850be1989db0d876026d2bffda067d7923f173c3966faa6
4
- data.tar.gz: 97fffa62c90ae5c20e7dcf00eb151b557c26ab5ae676c45b5651efa5143cf34c
3
+ metadata.gz: 35ea6871ead43684bcaba29452a4d21a63d40a2703e5a954c60318bc4242759f
4
+ data.tar.gz: bb819713b38b1639d9e0ccc4ac95bd171a054fc1025b330cbac492f980d93015
5
5
  SHA512:
6
- metadata.gz: dbe0c003a7e058f5ab6ac5592170ef1a26e02bf9be729b889c55a3a70af4e0c8b6e52f7157cc9b40879545689972769bae5deabf6814ce1ebeb97fdf1a128212
7
- data.tar.gz: d696cd95560d51b34318e7f25467450dde8461383dd17830f1177363cbf006c863b1268a2b79616e563343a3fd0e388c9d3bde67821b698b4cf0035bbfc9b719
6
+ metadata.gz: 80981e2b9473bac38edf29ee73aa49f4f5932b577ee8095e1af9407f113e9a156f5860049300c8b486ec66ff267ec8fd9b91007697d3d6e953cc65580e29e4b9
7
+ data.tar.gz: 45077ad45b7d833dddaee515736c3faf54b5472e684a1e0e4220c1bff1b6ba6b9284bea082b235eb7371540af95481e728ad09c082ae40f5cf3d6d77f45e2f11
checksums.yaml.gz.sig CHANGED
Binary file
@@ -44,9 +44,9 @@ module Mongoid
44
44
  # @return [ true, false ] True if the classes are equal, false if not.
45
45
  def ===(other)
46
46
  if Mongoid.legacy_triple_equals
47
- super
48
- else
49
47
  other.class == Class ? self.class === other : self == other
48
+ else
49
+ super
50
50
  end
51
51
  end
52
52
 
@@ -73,9 +73,9 @@ module Mongoid
73
73
  # @return [ true, false ] True if the classes are equal, false if not.
74
74
  def ===(other)
75
75
  if Mongoid.legacy_triple_equals
76
- other.is_a?(self)
77
- else
78
76
  other.class == Class ? self <= other : other.is_a?(self)
77
+ else
78
+ other.is_a?(self)
79
79
  end
80
80
  end
81
81
  end
@@ -289,15 +289,17 @@ module Mongoid
289
289
  # @return [ Method ] The defined method.
290
290
  def define_scope_method(name)
291
291
  singleton_class.class_eval do
292
- define_method(name) do |*args|
293
- scoping = _declared_scopes[name]
294
- scope = instance_exec(*args, &scoping[:scope])
295
- extension = scoping[:extension]
296
- to_merge = scope || queryable
297
- criteria = to_merge.empty_and_chainable? ? to_merge : with_default_scope.merge(to_merge)
298
- criteria.extend(extension)
299
- criteria
300
- end
292
+ ruby2_keywords(
293
+ define_method(name) do |*args|
294
+ scoping = _declared_scopes[name]
295
+ scope = instance_exec(*args, &scoping[:scope])
296
+ extension = scoping[:extension]
297
+ to_merge = scope || queryable
298
+ criteria = to_merge.empty_and_chainable? ? to_merge : with_default_scope.merge(to_merge)
299
+ criteria.extend(extension)
300
+ criteria
301
+ end
302
+ )
301
303
  end
302
304
  end
303
305
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Mongoid
4
- VERSION = "7.5.0"
4
+ VERSION = "7.5.1"
5
5
  end
@@ -85,8 +85,8 @@ describe Mongoid::Equality do
85
85
 
86
86
  describe ".===" do
87
87
 
88
- context "when legacy_triple_equals is set" do
89
- config_override :legacy_triple_equals, true
88
+ context "when legacy_triple_equals is not set" do
89
+ config_override :legacy_triple_equals, false
90
90
 
91
91
  context "when comparable is an instance of this document" do
92
92
 
@@ -128,8 +128,8 @@ describe Mongoid::Equality do
128
128
  end
129
129
  end
130
130
 
131
- context "when legacy_triple_equals is not set" do
132
- config_override :legacy_triple_equals, false
131
+ context "when legacy_triple_equals is set" do
132
+ config_override :legacy_triple_equals, true
133
133
 
134
134
  context "when comparable is an instance of this document" do
135
135
 
@@ -205,8 +205,8 @@ describe Mongoid::Equality do
205
205
 
206
206
  context "when the class is the same" do
207
207
 
208
- it "returns false" do
209
- expect(person === Person).to be false
208
+ it "returns true" do
209
+ expect(person === Person).to be true
210
210
  end
211
211
  end
212
212
 
@@ -219,8 +219,8 @@ describe Mongoid::Equality do
219
219
 
220
220
  context "when the class is a superclass" do
221
221
 
222
- it "returns false" do
223
- expect(Doctor.new === Person).to be false
222
+ it "returns true" do
223
+ expect(Doctor.new === Person).to be true
224
224
  end
225
225
  end
226
226
  end
@@ -256,8 +256,8 @@ describe Mongoid::Equality do
256
256
  context "when comparing to a class" do
257
257
  context "when the class is the same" do
258
258
 
259
- it "returns true" do
260
- expect(person === Person).to be true
259
+ it "returns false" do
260
+ expect(person === Person).to be false
261
261
  end
262
262
  end
263
263
 
@@ -270,8 +270,8 @@ describe Mongoid::Equality do
270
270
 
271
271
  context "when the class is a superclass" do
272
272
 
273
- it "returns true" do
274
- expect(Doctor.new === Person).to be true
273
+ it "returns false" do
274
+ expect(Doctor.new === Person).to be false
275
275
  end
276
276
  end
277
277
  end
@@ -481,27 +481,45 @@ describe Mongoid::Scopable do
481
481
 
482
482
  context "when a block is provided" do
483
483
 
484
- before do
485
- Band.scope(:active, ->{ Band.where(active: true) }) do
486
- def add_origin
487
- tap { |c| c.selector[:origin] = "Deutschland" }
488
- end
484
+ context "when with optional and keyword arguments" do
485
+ before do
486
+ Band.scope(:named_by, ->(name, deleted: false) {
487
+ Band.where(name: name, deleted: deleted)
488
+ })
489
489
  end
490
- end
491
490
 
492
- after do
493
- class << Band
494
- undef_method :active
491
+ let(:scope) do
492
+ Band.named_by("Emily", deleted: true)
495
493
  end
496
- Band._declared_scopes.clear
497
- end
498
494
 
499
- let(:scope) do
500
- Band.active.add_origin
495
+ it "sets the conditions from keyword arguments" do
496
+ scope.selector.should == {'name' => 'Emily', 'deleted' => true}
497
+ end
501
498
  end
502
499
 
503
- it "adds the extension to the scope" do
504
- expect(scope.selector).to eq({ "active" => true, "origin" => "Deutschland" })
500
+ context "when without arguments" do
501
+ before do
502
+ Band.scope(:active, ->{ Band.where(active: true) }) do
503
+ def add_origin
504
+ tap { |c| c.selector[:origin] = "Deutschland" }
505
+ end
506
+ end
507
+ end
508
+
509
+ after do
510
+ class << Band
511
+ undef_method :active
512
+ end
513
+ Band._declared_scopes.clear
514
+ end
515
+
516
+ let(:scope) do
517
+ Band.active.add_origin
518
+ end
519
+
520
+ it "adds the extension to the scope" do
521
+ expect(scope.selector).to eq({ "active" => true, "origin" => "Deutschland" })
522
+ end
505
523
  end
506
524
  end
507
525
 
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.5.0
4
+ version: 7.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Durran Jordan
@@ -30,7 +30,7 @@ cert_chain:
30
30
  +WyKQ+QTIdtDiyf2LQmxWnxt/W1CmScjdLS7/yXGkkB/D9Uy+sJD747O/B9P238Q
31
31
  XnerrtyOu04RsWDvaZkCwSDVzoqfICh4CP1mlde73Ts=
32
32
  -----END CERTIFICATE-----
33
- date: 2022-07-20 00:00:00.000000000 Z
33
+ date: 2022-07-23 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: activemodel
metadata.gz.sig CHANGED
Binary file