From 689fb889253baa322c84d2fb378ebd14d775414b Mon Sep 17 00:00:00 2001 From: Jon Rowe Date: Tue, 12 May 2020 09:50:44 +0100 Subject: [PATCH] Add back Ruby 2.2 support for Rails 5 --- .travis.yml | 6 ++++++ Gemfile | 4 +++- lib/rspec/rails/example/mailer_example_group.rb | 4 ++-- script/update_rubygems_and_install_bundler | 10 ++++++++-- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index dafe4cebf1..2d244199dd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -75,6 +75,8 @@ matrix: env: RAILS_VERSION='~> 5.2.0' - rvm: 2.3.8 env: RAILS_VERSION='~> 5.2.0' + - rvm: 2.2.10 + env: RAILS_VERSION='~> 5.2.0' # Rails 5.1 Builds >= 2.2.2 - rvm: 2.6.6 @@ -85,6 +87,8 @@ matrix: env: RAILS_VERSION='~> 5.1.0' - rvm: 2.3.8 env: RAILS_VERSION='~> 5.1.0' + - rvm: 2.2.10 + env: RAILS_VERSION='~> 5.1.0' # Rails 5.0 Builds >= 2.2.2 - rvm: 2.6.6 @@ -95,5 +99,7 @@ matrix: env: RAILS_VERSION='~> 5.0.0' - rvm: 2.3.8 env: RAILS_VERSION='~> 5.0.0' + - rvm: 2.2.10 + env: RAILS_VERSION='~> 5.0.0' fast_finish: true diff --git a/Gemfile b/Gemfile index 07d5f4c98d..b010a45908 100644 --- a/Gemfile +++ b/Gemfile @@ -56,7 +56,9 @@ end gem "rubyzip", '~> 1.2' -gem 'rubocop', '~> 0.80.1' +if RUBY_VERSION.to_f >= 2.3 + gem 'rubocop', '~> 0.80.1' +end custom_gemfile = File.expand_path('Gemfile-custom', __dir__) eval_gemfile custom_gemfile if File.exist?(custom_gemfile) diff --git a/lib/rspec/rails/example/mailer_example_group.rb b/lib/rspec/rails/example/mailer_example_group.rb index 874c773cf7..fd86fe9427 100644 --- a/lib/rspec/rails/example/mailer_example_group.rb +++ b/lib/rspec/rails/example/mailer_example_group.rb @@ -21,8 +21,8 @@ module MailerExampleGroup included do include ::Rails.application.routes.url_helpers - options = ::Rails.configuration.action_mailer.default_url_options - options&.each { |key, value| default_url_options[key] = value } + options = ::Rails.configuration.action_mailer.default_url_options || {} + options.each { |key, value| default_url_options[key] = value } end # Class-level DSL for mailer specs. diff --git a/script/update_rubygems_and_install_bundler b/script/update_rubygems_and_install_bundler index c5372151e4..2ecbbf294a 100755 --- a/script/update_rubygems_and_install_bundler +++ b/script/update_rubygems_and_install_bundler @@ -5,5 +5,11 @@ set -e source script/functions.sh -gem update --no-document --system -gem install --no-document bundler +if is_ruby_23_plus; then + gem update --no-document --system + gem install --no-document bundler +else + echo "Warning installing older versions of Rubygems / Bundler" + gem update --system '2.7.8' + gem install bundler -v '1.17.3' +fi