From 7876ee2d67d9ae93140ba8ec613fd35707f9fa75 Mon Sep 17 00:00:00 2001 From: Daniel Waterworth Date: Wed, 15 Apr 2020 16:42:48 +0100 Subject: [PATCH] DEV: upgrade Rails Latest version of Rails contains compatibility fixes for Ruby 2.7 and some minor security fixes we would like to have It also broke some of the multisite tests. Rails tries to use the same connection for reading from a replica as writing to the leader during tests, because, with everything happening in a transaction, changes to the DB wouldn't otherwise be reflected in the replica connection. The difference now is that Rails tries to do this for connections opened after the test has started which affected rails multisite connections. The upshot of this is that, as things stand, you are likely to experience problems if you try to connect to a different multisite DB in a test when the `current_db` is not 'default'. --- Gemfile | 14 +++++------ Gemfile.lock | 56 ++++++++++++++++++++++---------------------- spec/rails_helper.rb | 2 ++ 3 files changed, 37 insertions(+), 35 deletions(-) diff --git a/Gemfile b/Gemfile index 9e4b7cb7bf..d0844e45e8 100644 --- a/Gemfile +++ b/Gemfile @@ -18,13 +18,13 @@ else # this allows us to include the bits of rails we use without pieces we do not. # # To issue a rails update bump the version number here - gem 'actionmailer', '6.0.1' - gem 'actionpack', '6.0.1' - gem 'actionview', '6.0.1' - gem 'activemodel', '6.0.1' - gem 'activerecord', '6.0.1' - gem 'activesupport', '6.0.1' - gem 'railties', '6.0.1' + gem 'actionmailer', '6.0.2.2' + gem 'actionpack', '6.0.2.2' + gem 'actionview', '6.0.2.2' + gem 'activemodel', '6.0.2.2' + gem 'activerecord', '6.0.2.2' + gem 'activesupport', '6.0.2.2' + gem 'railties', '6.0.2.2' gem 'sprockets-rails' end diff --git a/Gemfile.lock b/Gemfile.lock index ef1c3e67ee..fa0105851f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,21 +1,21 @@ GEM remote: https://rubygems.org/ specs: - actionmailer (6.0.1) - actionpack (= 6.0.1) - actionview (= 6.0.1) - activejob (= 6.0.1) + actionmailer (6.0.2.2) + actionpack (= 6.0.2.2) + actionview (= 6.0.2.2) + activejob (= 6.0.2.2) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (6.0.1) - actionview (= 6.0.1) - activesupport (= 6.0.1) - rack (~> 2.0) + actionpack (6.0.2.2) + actionview (= 6.0.2.2) + activesupport (= 6.0.2.2) + rack (~> 2.0, >= 2.0.8) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actionview (6.0.1) - activesupport (= 6.0.1) + actionview (6.0.2.2) + activesupport (= 6.0.2.2) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) @@ -24,15 +24,15 @@ GEM actionview (>= 6.0.a) active_model_serializers (0.8.4) activemodel (>= 3.0) - activejob (6.0.1) - activesupport (= 6.0.1) + activejob (6.0.2.2) + activesupport (= 6.0.2.2) globalid (>= 0.3.6) - activemodel (6.0.1) - activesupport (= 6.0.1) - activerecord (6.0.1) - activemodel (= 6.0.1) - activesupport (= 6.0.1) - activesupport (6.0.1) + activemodel (6.0.2.2) + activesupport (= 6.0.2.2) + activerecord (6.0.2.2) + activemodel (= 6.0.2.2) + activesupport (= 6.0.2.2) + activesupport (6.0.2.2) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) @@ -283,9 +283,9 @@ GEM rails_multisite (2.1.1) activerecord (> 5.0, < 7) railties (> 5.0, < 7) - railties (6.0.1) - actionpack (= 6.0.1) - activesupport (= 6.0.1) + railties (6.0.2.2) + actionpack (= 6.0.2.2) + activesupport (= 6.0.2.2) method_source rake (>= 0.8.7) thor (>= 0.20.3, < 2.0) @@ -425,14 +425,14 @@ PLATFORMS ruby DEPENDENCIES - actionmailer (= 6.0.1) - actionpack (= 6.0.1) - actionview (= 6.0.1) + actionmailer (= 6.0.2.2) + actionpack (= 6.0.2.2) + actionview (= 6.0.2.2) actionview_precompiler active_model_serializers (~> 0.8.3) - activemodel (= 6.0.1) - activerecord (= 6.0.1) - activesupport (= 6.0.1) + activemodel (= 6.0.2.2) + activerecord (= 6.0.2.2) + activesupport (= 6.0.2.2) addressable annotate aws-sdk-s3 @@ -512,7 +512,7 @@ DEPENDENCIES rack-mini-profiler rack-protection rails_multisite - railties (= 6.0.1) + railties (= 6.0.2.2) rake rb-fsevent rb-inotify (~> 0.9) diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 011dc0309e..04a90b3e06 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -244,6 +244,8 @@ RSpec.configure do |config| RailsMultisite::ConnectionManagement.config_filename = "spec/fixtures/multisite/two_dbs.yml" + + RailsMultisite::ConnectionManagement.establish_connection(db: 'default') end config.after(:each, type: :multisite) do