Skip to content

Commit b5c59ea

Browse files
committed
Merge pull request #2226 from rspec/cleanup-unsupported-ruby-and-rails-4-checks
Drop code related to Rails < 5.0 & Ruby < 2.3.0
1 parent 7ab92aa commit b5c59ea

File tree

54 files changed

+71
-1103
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+71
-1103
lines changed

.rubocop.yml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -246,12 +246,6 @@ Style/ParallelAssignment:
246246
Style/ParenthesesAroundCondition:
247247
Enabled: false
248248

249-
Style/PerlBackrefs:
250-
Exclude:
251-
# We probably can refactor the backref out, but for now excluding it since
252-
# we can't use named matches in 1.8.7
253-
- lib/generators/rspec/scaffold/scaffold_generator.rb
254-
255249
Style/PercentLiteralDelimiters:
256250
PreferredDelimiters:
257251
'%': () # double-quoted string
@@ -264,12 +258,6 @@ Style/PercentLiteralDelimiters:
264258
'%W': '[]' # array of double-quoted strings
265259
'%x': () # a shell command as a string
266260

267-
# On 1.8 `proc` was `lambda`, so we used `Proc.new` to ensure we got real procs
268-
# on all supported versions.
269-
# http://batsov.com/articles/2014/02/04/the-elements-of-style-in-ruby-number-12-proc-vs-proc-dot-new/
270-
Style/Proc:
271-
Enabled: false
272-
273261
Style/RegexpLiteral:
274262
Enabled: false
275263

.rubocop_todo.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,14 @@ Style/EachWithObject:
2121
# the new lambda syntax was not supported in ruby 1.8.7
2222
Style/Lambda:
2323
Enabled: false
24+
25+
# we couldn't use named matches in ruby 1.8.7
26+
Style/PerlBackrefs:
27+
Exclude:
28+
- lib/generators/rspec/scaffold/scaffold_generator.rb
29+
30+
# On 1.8 `proc` was `lambda`, so we used `Proc.new` to ensure we got real procs
31+
# on all supported versions.
32+
# http://batsov.com/articles/2014/02/04/the-elements-of-style-in-ruby-number-12-proc-vs-proc-dot-new/
33+
Style/Proc:
34+
Enabled: false

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,10 @@ bundler_args: "--binstubs --path ../bundle --retry=3 --jobs=3"
2222

2323
before_install:
2424
- script/update_rubygems_and_install_bundler
25-
- script/downgrade_bundler_on_old_rails
2625
- script/clone_all_rspec_repos
2726

2827
before_script:
29-
# Rails 4.x complains with a bundler rails binstub in PROJECT_ROOT/bin/
28+
# Rails 4+ complains with a bundler rails binstub in PROJECT_ROOT/bin/
3029
- rm -f bin/rails
3130
- bundle exec rails --version
3231

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ gem 'mime-types', "~> 3"
5151
gem 'capybara', '~> 2.13', require: false
5252

5353
if MAJOR < 6
54-
gem 'nokogiri', '1.8.5'
54+
gem 'nokogiri', '1.9.1'
5555
else
5656
gem 'nokogiri', '>= 1.10.4'
5757
end

Gemfile-custom.sample

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,5 @@ group :development do
88
platform :mri do
99
gem 'rb-fsevent', '~> 0.9.0'
1010
gem 'ruby-prof', '~> 0.10.0'
11-
12-
case RUBY_VERSION
13-
when /^1.8/
14-
gem 'ruby-debug'
15-
when /^1.9/
16-
gem 'debugger'
17-
end
1811
end
1912
end

Gemfile-rails-dependencies

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ when /master/
1414
gem 'puma', "3.12.1"
1515
gem 'activerecord-jdbcsqlite3-adapter', git: 'https://github.com/jruby/activerecord-jdbc-adapter', platforms: [:jruby]
1616
when /stable$/
17-
gem_list = %w[rails railties actionmailer actionpack activerecord activesupport]
18-
gem_list << 'activejob' if version >= '4-2-stable'
19-
gem_list << 'actionview' if version >= '4-2-stable'
17+
gem_list = %w[rails railties actionmailer actionpack activerecord activesupport activejob actionview]
2018
gem 'puma', "3.12.1" if version > '5-0-stable'
2119
gem 'activerecord-jdbcsqlite3-adapter', git: 'https://github.com/jruby/activerecord-jdbc-adapter', platforms: [:jruby]
2220

@@ -29,9 +27,7 @@ when nil, false, ""
2927
else
3028
gem "rails", version
3129

32-
if version >= '5-1-stable' && RUBY_VERSION >= "2.3"
33-
gem "puma"
34-
end
30+
gem "puma" if version >= '5-1-stable'
3531

3632
if version.gsub(/[^\d\.]/,'').to_f >= 6.0
3733
gem "activerecord-jdbcsqlite3-adapter", "~> 60.0.rc1", platforms: [:jruby]

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,7 @@ $ bundle exec rspec --help
119119
```
120120

121121
**Optional:** If `bundle exec rspec` is too verbose for you,
122-
you can generate a binstub at `bin/rspec`
123-
and use that instead (Rails 4+ only):
122+
you can generate a binstub at `bin/rspec` and use that instead:
124123

125124
```sh
126125
$ bundle binstubs rspec-core

Rakefile

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ require 'rspec/core/rake_task'
1212
require 'cucumber/rake/task'
1313

1414
def rails_template_command
15-
require "rails"
15+
require "rails/version"
1616
if Rails.version.to_f >= 5.0
1717
"app:template"
1818
else
@@ -27,7 +27,7 @@ RSpec::Core::RakeTask.new(:spec) do |t|
2727
end
2828

2929
Cucumber::Rake::Task.new(:cucumber) do |t|
30-
version = ENV.fetch("RAILS_VERSION", "~> 4.2.0")[/\d[\.-]\d/]
30+
version = ENV.fetch("RAILS_VERSION", "~> 5.2.0")[/\d[\.-]\d/]
3131
if version == "master" || version.nil?
3232
version = Float::INFINITY
3333
end
@@ -37,19 +37,10 @@ Cucumber::Rake::Task.new(:cucumber) do |t|
3737
tags << "~@rails_pre_5.1"
3838
end
3939

40-
if version.to_f >= 5.0
41-
tags << "~@rails_pre_5"
42-
end
43-
4440
if version.to_f == 5.0
4541
tags << "~@system_test"
4642
end
4743

48-
if tags.empty?
49-
tags << "~@rails_post_5"
50-
tags << "~@system_test"
51-
end
52-
5344
if version.to_f >= 6.0
5445
tags << "~@rails_pre_6"
5546
end
@@ -69,13 +60,13 @@ namespace :generate do
6960
unless File.directory?('./tmp/example_app')
7061
bindir = File.expand_path("bin")
7162

72-
# Rails 4 cannot use a `rails` binstub generated by Bundler
63+
# Rails 4+ cannot use a `rails` binstub generated by Bundler
7364
sh "rm -f #{bindir}/rails"
7465
sh "bundle exec rails new ./tmp/example_app --no-rc --skip-javascript --skip-bootsnap -skip-sprockets --skip-git --skip-test-unit --skip-listen --skip-bundle --template=example_app_generator/generate_app.rb"
7566

7667
in_example_app do
7768
sh "./travis_retry_bundle_install.sh 2>&1"
78-
# Rails 4 cannot use a `rails` binstub generated by Bundler
69+
# Rails 4+ cannot use a `rails` binstub generated by Bundler
7970
sh "bundle binstubs bundler rspec-core rake --force"
8071
sh "bundle binstubs railties" unless File.exist?("bin/rails")
8172

@@ -192,13 +183,13 @@ namespace :no_active_record do
192183
unless File.directory?(example_app_dir)
193184
bindir = File.expand_path("bin")
194185

195-
# Rails 4 cannot use a `rails` binstub generated by Bundler
186+
# Rails 4+ cannot use a `rails` binstub generated by Bundler
196187
sh "rm -f #{bindir}/rails"
197188
sh "bundle exec rails new #{example_app_dir} --no-rc --skip-active-record --skip-javascript --skip-bootsnap --skip-sprockets --skip-git --skip-test-unit --skip-listen --skip-bundle --template=example_app_generator/generate_app.rb"
198189

199190
in_example_app(:app_dir => example_app_dir) do
200191
sh "./travis_retry_bundle_install.sh 2>&1"
201-
# Rails 4 cannot use a `rails` binstub generated by Bundler
192+
# Rails 4+ cannot use a `rails` binstub generated by Bundler
202193
sh "bundle binstubs bundler rspec-core rake --force"
203194
sh "bundle binstubs railties" unless File.exist?("bin/rails")
204195

appveyor.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@ test_script:
3333

3434
environment:
3535
matrix:
36-
- ruby_version: 200
37-
- ruby_version: 21
38-
- ruby_version: 22
3936
- ruby_version: 23-x64
4037
- ruby_version: 24-x64
4138
- ruby_version: 25-x64

example_app_generator/generate_action_mailer_specs.rb

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
require 'active_support'
22
require 'active_support/core_ext/module'
33

4-
# We need to copy this method from Thor for older Rails versions
5-
def comment_lines(path, flag, *args)
6-
flag = flag.respond_to?(:source) ? flag.source : flag
7-
gsub_file(path, /^(\s*)([^#|\n]*#{flag})/, '\1# \2', *args)
8-
end
9-
104
using_source_path(File.expand_path('..', __FILE__)) do
115
# Comment out the default mailer stuff
126
comment_lines 'config/environments/development.rb', /action_mailer/

0 commit comments

Comments
 (0)