Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Commit 7329163

Browse files
authored
Merge pull request #2787 from rspec/drop-old-rubies
Drop Ruby < 2.3 support
2 parents e124e47 + f41dc2f commit 7329163

File tree

67 files changed

+364
-1009
lines changed

Some content is hidden

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

67 files changed

+364
-1009
lines changed

Changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
### Development
22

3+
Breaking Changes:
4+
5+
* Ruby < 2.3 is no longer supported. (Phil Pirozhkov, #2787)
6+
37
Enhancements:
48

59
* Improve pluralisation of words ending with `s` (like process). (Joshua Pinter, #2779)

Gemfile

Lines changed: 4 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,6 @@ branch = File.read(File.expand_path("../maintenance-branch", __FILE__)).chomp
1212
end
1313
end
1414

15-
if RUBY_VERSION < '1.9.3'
16-
gem 'rake', '< 11.0.0' # rake 11 requires Ruby 1.9.3 or later
17-
elsif RUBY_VERSION < '2.0.0'
18-
gem 'rake', '< 12.0.0' # rake 12 requires Ruby 2.0.0 or later
19-
else
20-
gem 'rake', '> 12.3.2'
21-
end
22-
2315
if ENV['DIFF_LCS_VERSION']
2416
gem 'diff-lcs', ENV['DIFF_LCS_VERSION']
2517
else
@@ -34,37 +26,10 @@ group :documentation do
3426
gem 'github-markup', :platform => :mri
3527
end
3628

37-
if RUBY_VERSION < '2.0.0' || RUBY_ENGINE == 'java'
38-
gem 'json', '< 2.0.0'
39-
else
40-
gem 'json', '> 2.3.0'
41-
end
29+
# Until 1.13.2 is released due to Rubygems usage
30+
gem 'ffi', '~> 1.12.0'
4231

43-
if RUBY_VERSION < '2.2.0' && !!(RbConfig::CONFIG['host_os'] =~ /cygwin|mswin|mingw|bccwin|wince|emx/)
44-
gem 'ffi', '< 1.10'
45-
elsif RUBY_VERSION < '2.0'
46-
gem 'ffi', '< 1.9.19' # ffi dropped Ruby 1.8 support in 1.9.19
47-
elsif RUBY_VERSION < '2.3.0'
48-
gem 'ffi', '~> 1.12.0'
49-
else
50-
# Until 1.13.2 is released due to Rubygems usage
51-
gem 'ffi', '~> 1.12.0'
52-
end
53-
54-
if RUBY_VERSION < '2.3.0' && !!(RbConfig::CONFIG['host_os'] =~ /cygwin|mswin|mingw|bccwin|wince|emx/)
55-
gem "childprocess", "< 1.0.0"
56-
end
57-
58-
platforms :jruby do
59-
if RUBY_VERSION < '1.9.0'
60-
# Pin jruby-openssl on older J Ruby
61-
gem "jruby-openssl", "< 0.10.0"
62-
# Pin child-process on older J Ruby
63-
gem "childprocess", "< 1.0.0"
64-
else
65-
gem "jruby-openssl"
66-
end
67-
end
32+
gem "jruby-openssl", platforms: :jruby
6833

6934
gem 'simplecov', '~> 0.8'
7035

@@ -73,14 +38,11 @@ if RUBY_VERSION >= '2.4' && RUBY_ENGINE == 'ruby'
7338
gem "rubocop", "~> 0.52.1"
7439
end
7540

76-
gem 'test-unit', '~> 3.0' if RUBY_VERSION.to_f >= 2.2
41+
gem 'test-unit', '~> 3.0'
7742

7843
# Version 5.12 of minitest requires Ruby 2.4
7944
if RUBY_VERSION < '2.4.0'
8045
gem 'minitest', '< 5.12.0'
8146
end
8247

83-
84-
gem 'contracts', '< 0.16' if RUBY_VERSION < '1.9.0'
85-
8648
eval File.read('Gemfile-custom') if File.exist?('Gemfile-custom')

Gemfile-custom.sample

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,6 @@ group :development do
88
platform :mri do
99
gem 'rb-fsevent', '~> 0.9.0'
1010
gem 'ruby-prof', '~> 0.13.0'
11-
12-
case RUBY_VERSION
13-
when /^1.8/
14-
gem 'ruby-debug'
15-
when /^1.9/
16-
gem 'debugger'
17-
end
11+
gem 'pry-byebug'
1812
end
1913
end

cucumber.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,2 @@
1-
<%
2-
exclusions = []
3-
exclusions << ' --tags ~@no-jruby' if RUBY_PLATFORM == 'java'
4-
%>
5-
default: --require features --strict --format progress --tags ~@wip<%= exclusions.join %> features
1+
default: --require features --strict --format progress --tags ~@wip features
62
wip: --require features --tags @wip:30 --wip features

features/expectation_framework_integration/configure_expectation_framework.feature

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ Feature: configure expectation framework
7272
"""
7373
And the output should contain "3 examples, 1 failure"
7474

75-
@broken-on-jruby-9000
7675
Scenario: Configure minitest assertions
7776
Given rspec-expectations is not installed
7877
And a file named "example_spec.rb" with:

features/step_definitions/additional_cli_steps.rb

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -232,13 +232,7 @@
232232

233233
module Normalization
234234
def normalize_failure_output(text)
235-
whitespace_normalized = text.lines.map { |line| line.sub(/\s+$/, '').sub(/:in .*$/, '') }.join
236-
237-
# 1.8.7 and JRuby produce slightly different output for `Hash#fetch` errors, so we
238-
# convert it to the same output here to match our expectation.
239-
whitespace_normalized.
240-
sub("IndexError", "KeyError").
241-
sub(/key not found.*$/, "key not found")
235+
text.lines.map { |line| line.sub(/\s+$/, '').sub(/:in .*$/, '') }.join
242236
end
243237
end
244238

features/step_definitions/core_standalone_steps.rb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
Given(/^only rspec-core is installed$/) do
2-
if RUBY_VERSION.to_f >= 1.9 # --disable-gems is invalid on 1.8.7
3-
# Ensure the gem versions of rspec-mocks and rspec-expectations
4-
# won't be loaded if available on the developers machine.
5-
set_environment_variable('RUBYOPT', ENV['RUBYOPT'] + ' --disable-gems')
6-
end
2+
# Ensure the gem versions of rspec-mocks and rspec-expectations
3+
# won't be loaded if available on the developers machine.
4+
set_environment_variable('RUBYOPT', ENV['RUBYOPT'] + ' --disable-gems')
75

86
# This will make `require_expect_syntax_in_aruba_specs.rb` (loaded
97
# automatically when the specs run) remove rspec-mocks and

features/support/jruby.rb

Lines changed: 0 additions & 4 deletions
This file was deleted.

lib/rspec/core.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
warnings
1313

1414
set
15-
flat_map
1615
filter_manager
1716
dsl
1817
notifications
@@ -101,10 +100,9 @@ def self.configure
101100
# The example being executed.
102101
#
103102
# The primary audience for this method is library authors who need access
104-
# to the example currently being executed and also want to support all
105-
# versions of RSpec 2 and 3.
103+
# to the example currently being executed and also want to support RSpec 2.
106104
#
107-
# @example
105+
# @example support for RSpec version 2
108106
#
109107
# RSpec.configure do |c|
110108
# # context.example is deprecated, but RSpec.current_example is not

lib/rspec/core/bisect/shell_command.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
RSpec::Support.require_rspec_core "shell_escape"
2+
RSpec::Support.require_rspec_support 'ruby_features'
23
require 'shellwords'
34

45
module RSpec
@@ -63,6 +64,7 @@ def spec_opts_without_bisect
6364
private
6465

6566
include RSpec::Core::ShellEscape
67+
6668
# On JRuby, Open3.popen3 does not handle shellescaped args properly:
6769
# https://github.com/jruby/jruby/issues/2767
6870
if RSpec::Support::Ruby.jruby?

0 commit comments

Comments
 (0)