Skip to content

Commit 2c781aa

Browse files
authored
Merge pull request rspec#2366 from rspec/fix-sprockets-dependency
Lock gems that fail to install on certain Ruby versions
2 parents 60dc9c4 + 8bc3f80 commit 2c781aa

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

Gemfile

+5-1
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,12 @@ gem 'rake', '~> 12'
4949

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

52-
if RUBY_VERSION.to_f == 2.2
52+
if RUBY_VERSION.to_f < 2.3
5353
gem 'capybara', '~> 3.1.0'
54+
elsif RUBY_VERSION.to_f < 2.4
55+
gem 'capybara', '< 3.16'
56+
elsif RUBY_VERSION.to_f < 2.5
57+
gem 'capybara', '< 3.33'
5458
else
5559
gem 'capybara', '>= 2.13', '< 4.0', require: false
5660
end

Gemfile-rails-dependencies

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ when /stable$/
1818
gem_list = %w[rails railties actionmailer actionpack activerecord activesupport activejob actionview]
1919
gem 'puma', "3.12.1" if version > '5-0-stable'
2020
gem 'activerecord-jdbcsqlite3-adapter', git: 'https://github.com/jruby/activerecord-jdbc-adapter', platforms: [:jruby]
21+
gem "sprockets", '~> 3.0' if RUBY_VERSION < '2.5'
2122

2223
gem_list.each do |rails_gem|
2324
gem rails_gem, :git => "https://github.com/rails/rails.git", :branch => version
@@ -28,7 +29,7 @@ when nil, false, ""
2829
gem 'activerecord-jdbcsqlite3-adapter', platforms: [:jruby]
2930
else
3031
gem "rails", version
31-
32+
gem "sprockets", '~> 3.0' if RUBY_VERSION < '2.5'
3233
gem "puma" if version >= '5-1-stable'
3334

3435
if version.gsub(/[^\d\.]/,'').to_f >= 6.0

example_app_generator/generate_app.rb

+11
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,22 @@
3535
gsub_file "Gemfile", /.*rails-controller-testing.*/, "gem 'rails-controller-testing', git: 'https://github.com/rails/rails-controller-testing'"
3636
end
3737

38+
if RUBY_VERSION < "2.3.0"
39+
gsub_file "Gemfile", /.*childprocess.*/, "gem 'childprocess', '< 2.0.0'"
40+
gsub_file "Gemfile", /.*i18n.*/, "gem 'i18n', '< 1.5.2'"
41+
gsub_file "Gemfile", /.*nio4r.*/, "gem 'nio4r', '< 2.4.0'"
42+
gsub_file "Gemfile", /.*public_suffix.*/, "gem 'public_suffix', '< 4.0.0'"
43+
gsub_file "Gemfile", /.*rack.*/, "gem 'rack', '< 2.2.0', '!= 2.1.0'"
44+
gsub_file "Gemfile", /.*xpath.*/, "gem 'xpath', '< 3.2.0'"
45+
end
46+
3847
if Rails::VERSION::STRING >= "5.1.0"
3948
if RUBY_VERSION < "2.3"
4049
gsub_file "Gemfile", /.*capybara.*/, "gem 'capybara', '~> 3.1.0'"
4150
elsif RUBY_VERSION < "2.4"
4251
gsub_file "Gemfile", /.*capybara.*/, "gem 'capybara', '~> 3.15.0'"
52+
elsif RUBY_VERSION < "2.5"
53+
gsub_file "Gemfile", /.*capybara.*/, "gem 'capybara', '~> 3.32.0'"
4354
end
4455
if Rails::VERSION::STRING >= "5.2.0"
4556
gsub_file "Gemfile", /.*chromedriver-helper.*/, "gem 'webdrivers', '< 4.0.0'"

0 commit comments

Comments
 (0)