mongoid 8.1.0 → 8.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1f5f0b81e26dba41d786804bd1213f2c05c4594ca9e05d0f62417fc15da6532e
4
- data.tar.gz: c44f03a981d2fc648822718522e2ee7e8db6fa3fec01764eb09d77a4183a3559
3
+ metadata.gz: 7c8aee259f97121ac5d253787ffef62a4be73f599715f05b85f3aa9db0cbdbeb
4
+ data.tar.gz: 91dd81468f04ba196460275f315767e6c291b3299272416f45591168937330d6
5
5
  SHA512:
6
- metadata.gz: bafd2e708f204e23b0e277df74f897d19a83f059eb34bff3b636231f6e76a83176a45ea1b49586bff52c44bc3a526bd0d988cec3441bc469514035ad0acc7272
7
- data.tar.gz: 59e6b77e3e03d94cb82fd2aad20c3951cbcc9f0872138ae76f6837986aad641cce339d5d51b8122047b5732266883708f847a7bd23c0ed2fe7bf8e19e834e045
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
@@ -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.
@@ -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
- Atomic::UPDATES.each do |update|
76
- send(update).clear
77
- end
75
+ reset_atomic_updates!
78
76
  changed_attributes.clear
79
77
  end
80
78
 
@@ -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 = {}
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Mongoid
4
- VERSION = "8.1.0"
4
+ VERSION = "8.1.1"
5
5
  end
@@ -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.cluster).to receive(:disconnect!).and_call_original
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