Skip to content

Commit

Permalink
Add back Ruby 2.2 support for Rails 5
Browse files Browse the repository at this point in the history
  • Loading branch information
JonRowe committed May 15, 2020
1 parent 0cd56e6 commit 79b4031
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 7 deletions.
6 changes: 6 additions & 0 deletions .travis.yml
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
10 changes: 8 additions & 2 deletions Gemfile
Expand Up @@ -46,7 +46,11 @@ gem 'rake', '~> 12'

gem 'mime-types', "~> 3"

gem 'capybara', '>= 2.13', '< 4.0', require: false
if RUBY_VERSION == '2.2.0'
gem 'capybara', '~> 3.1.0'
else
gem 'capybara', '>= 2.13', '< 4.0', require: false
end

if MAJOR < 6
gem 'nokogiri', '1.9.1'
Expand All @@ -56,7 +60,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)
Expand Down
4 changes: 2 additions & 2 deletions lib/rspec/rails/example/mailer_example_group.rb
Expand Up @@ -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.
Expand Down
10 changes: 8 additions & 2 deletions script/update_rubygems_and_install_bundler
Expand Up @@ -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
13 changes: 12 additions & 1 deletion spec/rspec/rails/example/view_example_group_spec.rb
Expand Up @@ -236,7 +236,18 @@ def _view; end # Stub method
expect(view_spec.view).to eq(view)
end

it 'is accessible to hooks' do
if RUBY_VERSION <= "2.3.0"
pending_only_on_ruby_22 = """
Rails 5.2.4.2 has a syntax error in ActionDispatch::Request::Session.
(A &. usage which does not work in 2.2.10)
It has been fixed but not released, this spec will not pass until that
has been released.
"""
else
pending_only_on_ruby_22 = false
end

it 'is accessible to hooks', pending: pending_only_on_ruby_22 do
with_isolated_config do
run_count = 0
RSpec.configuration.before(:each, type: :view) do
Expand Down

0 comments on commit 79b4031

Please sign in to comment.