DEV: Add compatibility for Rails 7.0+

DEV: Add compatibility for Rails 7.0+

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 2dd0267..c58b853 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -17,11 +17,15 @@ jobs:
       fail-fast: false
       matrix:
         ruby: ["2.5", "2.6", "2.7", "3.0"]
-        rails: ["5", "6.0", "6.1"]
+        rails: ["5", "6.0", "6.1", "7.0"]
         ok_to_fail: [""]
         exclude:
           - ruby: 3.0
             rails: 5
+          - ruby: 2.5
+            rails: 7.0
+          - ruby: 2.6
+            rails: 7.0
         include:
           - ruby: "2.7"
             rails: master
diff --git a/gemfiles/rails_7.0.gemfile b/gemfiles/rails_7.0.gemfile
new file mode 100644
index 0000000..c970052
--- /dev/null
+++ b/gemfiles/rails_7.0.gemfile
@@ -0,0 +1,12 @@
+# frozen_string_literal: true
+source 'https://rubygems.org'
+
+group :test do
+  gem 'activerecord', '> 7', '< 7.1'
+  gem 'railties', '> 7', '< 7.1'
+  gem 'rspec'
+  gem 'sqlite3', '~> 1.4'
+  gem 'byebug'
+  gem 'rubocop'
+  gem 'rubocop-discourse'
+end
diff --git a/lib/rails_multisite/connection_management.rb b/lib/rails_multisite/connection_management.rb
index 5a8f649..140b610 100644
--- a/lib/rails_multisite/connection_management.rb
+++ b/lib/rails_multisite/connection_management.rb
@@ -178,7 +178,7 @@ module RailsMultisite
     end
 
     def load_config!
-      configs = YAML::load(File.open(@config_filename))
+      configs = YAML.safe_load(File.open(@config_filename))
 
       no_prepared_statements = @default_spec.config[:prepared_statements] == false
 
diff --git a/rails_multisite.gemspec b/rails_multisite.gemspec
index e58d58a..3764394 100644
--- a/rails_multisite.gemspec
+++ b/rails_multisite.gemspec
@@ -17,9 +17,9 @@ Gem::Specification.new do |gem|
   gem.require_paths = ["lib"]
   gem.version       = RailsMultisite::VERSION
 
-  gem.required_ruby_version = ">=2.4.0"
+  gem.required_ruby_version = ">=2.5.0"
 
   %w{activerecord railties}.each do |gem_name|
-    gem.add_dependency gem_name, "> 5.0", "< 7"
+    gem.add_dependency gem_name, "> 5.0", "< 7.1"
   end
 end
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 3357628..0cde2f1 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -33,10 +33,10 @@ RSpec.configure do |config|
 
   def load_db_config(name)
     if defined?(ActiveRecord::DatabaseConfigurations)
-      configs = ActiveRecord::DatabaseConfigurations.new(YAML::load(File.open(fixture_path(name))))
+      configs = ActiveRecord::DatabaseConfigurations.new(YAML.safe_load(File.open(fixture_path(name))))
       ActiveRecord::Base.configurations = configs
     else
-      ActiveRecord::Base.configurations = YAML::load(File.open(fixture_path(name)))
+      ActiveRecord::Base.configurations = YAML.safe_load(File.open(fixture_path(name)))
     end
   end
 

GitHub sha: 5f2540f80f486330e593897aedd33994db844089

This commit appears in #29 which was approved by davidtaylorhq. It was merged by Flink.