mongoid 8.1.0 → 8.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/Rakefile +25 -0
- data/lib/mongoid/atomic.rb +7 -0
- data/lib/mongoid/changeable.rb +1 -3
- data/lib/mongoid/reloadable.rb +3 -5
- data/lib/mongoid/version.rb +1 -1
- data/spec/mongoid/reloadable_spec.rb +24 -0
- data/spec/mongoid_spec.rb +1 -3
- data.tar.gz.sig +0 -0
- metadata +654 -654
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c8aee259f97121ac5d253787ffef62a4be73f599715f05b85f3aa9db0cbdbeb
|
4
|
+
data.tar.gz: 91dd81468f04ba196460275f315767e6c291b3299272416f45591168937330d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77f061a14a9b65420c977d2df0b9fd0c5a00f96e0f0be996c8c08e469ed89b458ac50079a3cf0aa9997550ea858cb3b55931418ad12330dd454daa7f8105daed
|
7
|
+
data.tar.gz: 8844008ccaf7b53a964029e39fcbe626fbe62c0c1a890c331c65a853f518a4dcd9a9415a748281c541b4c8f7970816f57727a30899dc2af144a38c4696e0ef18
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/Rakefile
CHANGED
@@ -11,6 +11,15 @@ $: << File.join(ROOT, 'spec/shared/lib')
|
|
11
11
|
require "rake"
|
12
12
|
require "rspec/core/rake_task"
|
13
13
|
require 'mrss/spec_organizer'
|
14
|
+
require 'rubygems/package'
|
15
|
+
require 'rubygems/security/policies'
|
16
|
+
|
17
|
+
def signed_gem?(path_to_gem)
|
18
|
+
Gem::Package.new(path_to_gem, Gem::Security::HighSecurity).verify
|
19
|
+
true
|
20
|
+
rescue Gem::Security::Exception => e
|
21
|
+
false
|
22
|
+
end
|
14
23
|
|
15
24
|
$LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
|
16
25
|
require "mongoid/version"
|
@@ -103,3 +112,19 @@ namespace :release do
|
|
103
112
|
end
|
104
113
|
end
|
105
114
|
end
|
115
|
+
|
116
|
+
desc 'Verifies that all built gems in pkg/ are valid'
|
117
|
+
task :verify do
|
118
|
+
gems = Dir['pkg/*.gem']
|
119
|
+
if gems.empty?
|
120
|
+
puts 'There are no gems in pkg/ to verify'
|
121
|
+
else
|
122
|
+
gems.each do |gem|
|
123
|
+
if signed_gem?(gem)
|
124
|
+
puts "#{gem} is signed"
|
125
|
+
else
|
126
|
+
abort "#{gem} is not signed"
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
data/lib/mongoid/atomic.rb
CHANGED
@@ -311,6 +311,13 @@ module Mongoid
|
|
311
311
|
|
312
312
|
private
|
313
313
|
|
314
|
+
# Clears all pending atomic updates.
|
315
|
+
def reset_atomic_updates!
|
316
|
+
Atomic::UPDATES.each do |update|
|
317
|
+
send(update).clear
|
318
|
+
end
|
319
|
+
end
|
320
|
+
|
314
321
|
# Generates the atomic updates in the correct order.
|
315
322
|
#
|
316
323
|
# @example Generate the updates.
|
data/lib/mongoid/changeable.rb
CHANGED
@@ -72,9 +72,7 @@ module Mongoid
|
|
72
72
|
@previous_changes = changes
|
73
73
|
@attributes_before_last_save = @previous_attributes
|
74
74
|
@previous_attributes = attributes.dup
|
75
|
-
|
76
|
-
send(update).clear
|
77
|
-
end
|
75
|
+
reset_atomic_updates!
|
78
76
|
changed_attributes.clear
|
79
77
|
end
|
80
78
|
|
data/lib/mongoid/reloadable.rb
CHANGED
@@ -16,16 +16,14 @@ module Mongoid
|
|
16
16
|
#
|
17
17
|
# @return [ Document ] The document, reloaded.
|
18
18
|
def reload
|
19
|
-
if @atomic_selector
|
20
|
-
# Clear atomic_selector cache for sharded clusters. MONGOID-5076
|
21
|
-
remove_instance_variable('@atomic_selector')
|
22
|
-
end
|
23
|
-
|
24
19
|
reloaded = _reload
|
25
20
|
if Mongoid.raise_not_found_error && (reloaded.nil? || reloaded.empty?)
|
26
21
|
shard_keys = atomic_selector.with_indifferent_access.slice(*shard_key_fields, :_id)
|
27
22
|
raise Errors::DocumentNotFound.new(self.class, _id, shard_keys)
|
28
23
|
end
|
24
|
+
|
25
|
+
reset_atomic_updates!
|
26
|
+
|
29
27
|
@attributes = reloaded
|
30
28
|
@attributes_before_type_cast = @attributes.dup
|
31
29
|
@changed_attributes = {}
|
data/lib/mongoid/version.rb
CHANGED
@@ -390,6 +390,30 @@ describe Mongoid::Reloadable do
|
|
390
390
|
end
|
391
391
|
end
|
392
392
|
|
393
|
+
context 'when embeds_many is modified' do
|
394
|
+
let(:contractor1) { Contractor.new(name: 'b') }
|
395
|
+
let(:contractor2) { Contractor.new(name: 'c') }
|
396
|
+
|
397
|
+
let(:building) do
|
398
|
+
Building.create!(name: 'a', contractors: [ contractor1 ])
|
399
|
+
end
|
400
|
+
|
401
|
+
let(:more_contractors) { building.contractors + [ contractor2 ] }
|
402
|
+
|
403
|
+
let(:modified_building) do
|
404
|
+
building.tap do
|
405
|
+
building.assign_attributes contractors: more_contractors
|
406
|
+
end
|
407
|
+
end
|
408
|
+
|
409
|
+
let(:reloaded_building) { modified_building.reload }
|
410
|
+
|
411
|
+
it 'resets delayed_atomic_sets' do
|
412
|
+
expect(modified_building.delayed_atomic_sets).not_to be_empty
|
413
|
+
expect(reloaded_building.delayed_atomic_sets).to be_empty
|
414
|
+
end
|
415
|
+
end
|
416
|
+
|
393
417
|
context "when embedded document is nil" do
|
394
418
|
|
395
419
|
let(:palette) do
|
data/spec/mongoid_spec.rb
CHANGED
@@ -75,10 +75,8 @@ describe Mongoid do
|
|
75
75
|
end
|
76
76
|
|
77
77
|
it "disconnects from all active clients" do
|
78
|
-
pending 'https://jira.mongodb.org/browse/MONGOID-5621'
|
79
|
-
|
80
78
|
clients.each do |client|
|
81
|
-
expect(client
|
79
|
+
expect(client).to receive(:close).and_call_original
|
82
80
|
end
|
83
81
|
Mongoid.disconnect_clients
|
84
82
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|