Skip to content

Commit 80bdca1

Browse files
committed
Add back Ruby 2.2 support for Rails 5
1 parent 0cd56e6 commit 80bdca1

File tree

5 files changed

+36
-7
lines changed

5 files changed

+36
-7
lines changed

.travis.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ matrix:
7575
env: RAILS_VERSION='~> 5.2.0'
7676
- rvm: 2.3.8
7777
env: RAILS_VERSION='~> 5.2.0'
78+
- rvm: 2.2.10
79+
env: RAILS_VERSION='~> 5.2.0'
7880

7981
# Rails 5.1 Builds >= 2.2.2
8082
- rvm: 2.6.6
@@ -85,6 +87,8 @@ matrix:
8587
env: RAILS_VERSION='~> 5.1.0'
8688
- rvm: 2.3.8
8789
env: RAILS_VERSION='~> 5.1.0'
90+
- rvm: 2.2.10
91+
env: RAILS_VERSION='~> 5.1.0'
8892

8993
# Rails 5.0 Builds >= 2.2.2
9094
- rvm: 2.6.6
@@ -95,5 +99,7 @@ matrix:
9599
env: RAILS_VERSION='~> 5.0.0'
96100
- rvm: 2.3.8
97101
env: RAILS_VERSION='~> 5.0.0'
102+
- rvm: 2.2.10
103+
env: RAILS_VERSION='~> 5.0.0'
98104

99105
fast_finish: true

Gemfile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@ gem 'rake', '~> 12'
4646

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

49-
gem 'capybara', '>= 2.13', '< 4.0', require: false
49+
if RUBY_VERSION.to_f == 2.2
50+
gem 'capybara', '~> 3.1.0'
51+
else
52+
gem 'capybara', '>= 2.13', '< 4.0', require: false
53+
end
5054

5155
if MAJOR < 6
5256
gem 'nokogiri', '1.9.1'
@@ -56,7 +60,9 @@ end
5660

5761
gem "rubyzip", '~> 1.2'
5862

59-
gem 'rubocop', '~> 0.80.1'
63+
if RUBY_VERSION.to_f >= 2.3
64+
gem 'rubocop', '~> 0.80.1'
65+
end
6066

6167
custom_gemfile = File.expand_path('Gemfile-custom', __dir__)
6268
eval_gemfile custom_gemfile if File.exist?(custom_gemfile)

lib/rspec/rails/example/mailer_example_group.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ module MailerExampleGroup
2121

2222
included do
2323
include ::Rails.application.routes.url_helpers
24-
options = ::Rails.configuration.action_mailer.default_url_options
25-
options&.each { |key, value| default_url_options[key] = value }
24+
options = ::Rails.configuration.action_mailer.default_url_options || {}
25+
options.each { |key, value| default_url_options[key] = value }
2626
end
2727

2828
# Class-level DSL for mailer specs.

script/update_rubygems_and_install_bundler

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,11 @@
55
set -e
66
source script/functions.sh
77

8-
gem update --no-document --system
9-
gem install --no-document bundler
8+
if is_ruby_23_plus; then
9+
gem update --no-document --system
10+
gem install --no-document bundler
11+
else
12+
echo "Warning installing older versions of Rubygems / Bundler"
13+
gem update --system '2.7.8'
14+
gem install bundler -v '1.17.3'
15+
fi

spec/rspec/rails/example/view_example_group_spec.rb

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,18 @@ def _view; end # Stub method
236236
expect(view_spec.view).to eq(view)
237237
end
238238

239-
it 'is accessible to hooks' do
239+
if RUBY_VERSION <= "2.3.0" && ::Rails.version.to_f == 5.2
240+
pending_only_on_ruby_22_rails_52 = """
241+
Rails 5.2.4.2 has a syntax error in ActionDispatch::Request::Session.
242+
(A &. usage which does not work in 2.2.10)
243+
It has been fixed but not released, this spec will not pass until that
244+
has been released.
245+
"""
246+
else
247+
pending_only_on_ruby_22_rails_52 = false
248+
end
249+
250+
it 'is accessible to hooks', pending: pending_only_on_ruby_22_rails_52 do
240251
with_isolated_config do
241252
run_count = 0
242253
RSpec.configuration.before(:each, type: :view) do

0 commit comments

Comments
 (0)