Skip to content

Commit eafe0b0

Browse files
committed
Remove code related to Rails < 5.0
1 parent 7d68eb2 commit eafe0b0

Some content is hidden

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

52 files changed

+78
-1221
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 & 14 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

@@ -85,16 +84,4 @@ matrix:
8584
- rvm: 2.3.8
8685
env: RAILS_VERSION='~> 5.0.0'
8786

88-
# Rails 4.2 Builds >= 1.9.3
89-
- rvm: 2.5.5
90-
env: RAILS_VERSION='~> 4.2.0'
91-
- rvm: 2.4.6
92-
env: RAILS_VERSION='~> 4.2.0'
93-
- rvm: 2.4.6
94-
env: RAILS_VERSION='~> 4.2.0'
95-
- rvm: 2.3.8
96-
env: RAILS_VERSION='~> 4.2.0'
97-
- rvm: 2.3.8
98-
env: RAILS_VERSION='~> 4.2.0'
99-
10087
fast_finish: true

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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ when /master/
1515
gem 'activerecord-jdbcsqlite3-adapter', git: 'https://github.com/jruby/activerecord-jdbc-adapter', platforms: [:jruby]
1616
when /stable$/
1717
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'
18+
gem_list << 'activejob'
19+
gem_list << 'actionview'
2020
gem 'puma', "3.12.1" if version > '5-0-stable'
2121
gem 'activerecord-jdbcsqlite3-adapter', git: 'https://github.com/jruby/activerecord-jdbc-adapter', platforms: [:jruby]
2222

@@ -29,7 +29,7 @@ when nil, false, ""
2929
else
3030
gem "rails", version
3131

32-
if version >= '5-1-stable' && RUBY_VERSION >= "2.3"
32+
if version >= '5-1-stable'
3333
gem "puma"
3434
end
3535

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 & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,7 @@ require 'rspec/core/rake_task'
1212
require 'cucumber/rake/task'
1313

1414
def rails_template_command
15-
require "rails"
16-
if Rails.version.to_f >= 5.0
17-
"app:template"
18-
else
19-
"rails:template"
20-
end
15+
"app:template"
2116
end
2217

2318
desc "Run all examples"
@@ -27,7 +22,7 @@ RSpec::Core::RakeTask.new(:spec) do |t|
2722
end
2823

2924
Cucumber::Rake::Task.new(:cucumber) do |t|
30-
version = ENV.fetch("RAILS_VERSION", "~> 4.2.0")[/\d[\.-]\d/]
25+
version = ENV.fetch("RAILS_VERSION", "~> 5.2.0")[/\d[\.-]\d/]
3126
if version == "master" || version.nil?
3227
version = Float::INFINITY
3328
end
@@ -37,19 +32,10 @@ Cucumber::Rake::Task.new(:cucumber) do |t|
3732
tags << "~@rails_pre_5.1"
3833
end
3934

40-
if version.to_f >= 5.0
41-
tags << "~@rails_pre_5"
42-
end
43-
4435
if version.to_f == 5.0
4536
tags << "~@system_test"
4637
end
4738

48-
if tags.empty?
49-
tags << "~@rails_post_5"
50-
tags << "~@system_test"
51-
end
52-
5339
if version.to_f >= 6.0
5440
tags << "~@rails_pre_6"
5541
end
@@ -69,13 +55,13 @@ namespace :generate do
6955
unless File.directory?('./tmp/example_app')
7056
bindir = File.expand_path("bin")
7157

72-
# Rails 4 cannot use a `rails` binstub generated by Bundler
58+
# Rails 4+ cannot use a `rails` binstub generated by Bundler
7359
sh "rm -f #{bindir}/rails"
7460
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"
7561

7662
in_example_app do
7763
sh "./travis_retry_bundle_install.sh 2>&1"
78-
# Rails 4 cannot use a `rails` binstub generated by Bundler
64+
# Rails 4+ cannot use a `rails` binstub generated by Bundler
7965
sh "bundle binstubs bundler rspec-core rake --force"
8066
sh "bundle binstubs railties" unless File.exist?("bin/rails")
8167

@@ -192,13 +178,13 @@ namespace :no_active_record do
192178
unless File.directory?(example_app_dir)
193179
bindir = File.expand_path("bin")
194180

195-
# Rails 4 cannot use a `rails` binstub generated by Bundler
181+
# Rails 4+ cannot use a `rails` binstub generated by Bundler
196182
sh "rm -f #{bindir}/rails"
197183
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"
198184

199185
in_example_app(:app_dir => example_app_dir) do
200186
sh "./travis_retry_bundle_install.sh 2>&1"
201-
# Rails 4 cannot use a `rails` binstub generated by Bundler
187+
# Rails 4+ cannot use a `rails` binstub generated by Bundler
202188
sh "bundle binstubs bundler rspec-core rake --force"
203189
sh "bundle binstubs railties" unless File.exist?("bin/rails")
204190

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_app.rb

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,8 @@
2525
gsub_file "Gemfile", /.*puma.*/, ""
2626
gsub_file "Gemfile", /.*gem..sqlite3.*/, "gem 'sqlite3', '~> 1.3.6'"
2727
gsub_file "Gemfile", /.*bootsnap.*/, ""
28-
if RUBY_VERSION < '2.2.2'
29-
gsub_file "Gemfile", /.*rdoc.*/, "gem 'rdoc', '< 6'"
30-
end
3128

32-
if Rails::VERSION::STRING >= '5.0.0'
33-
append_to_file('Gemfile', "gem 'rails-controller-testing'\n")
34-
end
29+
append_to_file('Gemfile', "gem 'rails-controller-testing'\n")
3530

3631
if Rails::VERSION::STRING >= '6'
3732
gsub_file "Gemfile", /.*gem..sqlite3.*/, "gem 'sqlite3', '~> 1.4'"
@@ -42,7 +37,7 @@
4237
if RUBY_VERSION < "2.4"
4338
gsub_file "Gemfile", /.*capybara.*/, "gem 'capybara', '~> 3.15.0'"
4439
end
45-
if Rails::VERSION::STRING >= "5.2.0" && RUBY_VERSION < '2.3.0'
40+
if Rails::VERSION::STRING >= "5.2.0"
4641
gsub_file "Gemfile", /.*chromedriver-helper.*/, "gem 'webdrivers', '< 4.0.0'"
4742
else
4843
gsub_file "Gemfile", /.*chromedriver-helper.*/, "gem 'webdrivers'"
@@ -63,21 +58,7 @@
6358

6459
# Use our version of RSpec and Rails
6560
append_to_file 'Gemfile', <<-EOT.gsub(/^ +\|/, '')
66-
|# Rack::Cache 1.3.0 requires Ruby >= 2.0.0
67-
|gem 'rack-cache', '< 1.3.0' if RUBY_VERSION < '2.0.0'
68-
|
69-
|if RUBY_VERSION >= '2.0.0'
70-
| gem 'rake', '>= 10.0.0'
71-
|elsif RUBY_VERSION >= '1.9.3'
72-
| gem 'rake', '< 12.0.0' # rake 12 requires Ruby 2.0.0 or later
73-
|else
74-
| gem 'rake', '< 11.0.0' # rake 11 requires Ruby 1.9.3 or later
75-
|end
76-
|
77-
|# Version 3 of mime-types 3 requires Ruby 2.0
78-
|if RUBY_VERSION < '2.0.0'
79-
| gem 'mime-types', '< 3'
80-
|end
61+
|gem 'rake', '>= 10.0.0'
8162
|
8263
|gem 'rspec-rails',
8364
| :path => '#{rspec_rails_repo_path}',

example_app_generator/no_active_record/app/models/in_memory/model.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# Rails 4.0.x seems to be the only version that does not autoload `ActiveModel`
2-
require 'active_model'
3-
41
raise "ActiveRecord is defined but should not be!" if defined?(::ActiveRecord)
52

63
module InMemory

example_app_generator/spec/verify_mailer_preview_path_spec.rb

Lines changed: 3 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,8 @@ def as_commandline(ops)
1616
end
1717

1818
def capture_exec(*ops)
19-
io = if RUBY_VERSION.to_f < 1.9
20-
IO.popen(as_commandline(ops))
21-
else
22-
ops << { :err => [:child, :out] }
23-
IO.popen(ops)
24-
end
19+
ops << { :err => [:child, :out] }
20+
io = IO.popen(ops)
2521
# Necessary to ignore warnings from Rails code base
2622
out = io.readlines.
2723
reject { |line| line =~ /warning: circular argument reference/ }.
@@ -38,7 +34,7 @@ def have_no_preview
3834
File.expand_path(File.join(__FILE__, '../support/default_preview_path'))
3935
}
4036

41-
if RSpec::Rails::FeatureCheck.has_action_mailer_show_preview?
37+
if RSpec::Rails::FeatureCheck.has_action_mailer_preview?
4238
context 'in the development environment' do
4339
let(:custom_env) { { 'RAILS_ENV' => rails_env } }
4440
let(:rails_env) { 'development' }
@@ -110,71 +106,6 @@ def have_no_preview
110106
).to eq('test-host')
111107
end
112108

113-
it 'handles action mailer not being available' do
114-
expect(
115-
capture_exec(
116-
custom_env.merge('NO_ACTION_MAILER' => 'true'),
117-
exec_script
118-
)
119-
).to have_no_preview
120-
end
121-
end
122-
elsif RSpec::Rails::FeatureCheck.has_action_mailer_preview?
123-
context 'in the development environment', 'without `show_previews`' do
124-
let(:custom_env) { { 'RAILS_ENV' => rails_env } }
125-
let(:rails_env) { 'development' }
126-
127-
it 'sets the preview path to the default rspec path' do
128-
expect(capture_exec(custom_env, exec_script)).to eq(
129-
"#{::Rails.root}/spec/mailers/previews"
130-
)
131-
end
132-
133-
it 'respects a custom `preview_path`' do
134-
expect(
135-
capture_exec(
136-
custom_env.merge('CUSTOM_PREVIEW_PATH' => '/custom/path'),
137-
exec_script
138-
)
139-
).to eq('/custom/path')
140-
end
141-
142-
it 'allows initializers to set options' do
143-
expect(
144-
capture_exec(
145-
custom_env.merge('DEFAULT_URL' => 'test-host'),
146-
exec_script
147-
)
148-
).to eq('test-host')
149-
end
150-
151-
it 'handles action mailer not being available' do
152-
expect(
153-
capture_exec(
154-
custom_env.merge('NO_ACTION_MAILER' => 'true'),
155-
exec_script
156-
)
157-
).to have_no_preview
158-
end
159-
end
160-
161-
context 'in a non-development environment', 'without `show_previews`' do
162-
let(:custom_env) { { 'RAILS_ENV' => rails_env } }
163-
let(:rails_env) { 'test' }
164-
165-
it 'does not set the preview path by default' do
166-
expect(capture_exec(custom_env, exec_script)).to have_no_preview
167-
end
168-
169-
it 'respects a custom `preview_path`' do
170-
expect(
171-
capture_exec(
172-
custom_env.merge('CUSTOM_PREVIEW_PATH' => '/custom/path'),
173-
exec_script
174-
)
175-
).to eq('/custom/path')
176-
end
177-
178109
it 'handles action mailer not being available' do
179110
expect(
180111
capture_exec(

example_app_generator/travis_retry_bundle_install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -e
44
source FUNCTIONS_SCRIPT_FILE
55

66
echo "Starting bundle install using shared bundle path"
7-
if is_mri_192_plus; then
7+
if is_mri; then
88
travis_retry eval "RUBYOPT=$RUBYOPT:' --enable rubygems' bundle install --gemfile ./Gemfile --path REPLACE_BUNDLE_PATH --retry=3 --jobs=3"
99
else
1010
travis_retry eval "bundle install --gemfile ./Gemfile --path REPLACE_BUNDLE_PATH --retry=3 --jobs=3"

0 commit comments

Comments
 (0)