Skip to content

Commit ea9e921

Browse files
committed
Drop pre-2.7 Ruby version checks
The gemspec already requires Ruby >= 2.7, so RUBY_VERSION < "2.5"/"2.6" guards are dead code. Trim the runtime checks in result_adapter_spec.rb and the @rails6 / @Ruby26 cucumber gates, and condense the historical Ruby 2.5/2.6 coverage-API commentary in simplecov.rb. The remaining runtime feature detection (`coverage_start_arguments_supported?`, TruffleRuby/JRuby engine skips) is preserved — those guard alternate engines, not Ruby versions.
1 parent bd1abf4 commit ea9e921

6 files changed

Lines changed: 9 additions & 46 deletions

File tree

features/oneshot_line_coverage.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@rspec @oneshot_line_coverage @ruby26
1+
@rspec @oneshot_line_coverage
22
Feature:
33

44
Simply executing oneshot_line coverage gives ok results.

features/rspec_rails.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@rspec @disable-bundler @rails6
1+
@rspec @disable-bundler
22

33
Feature:
44
Make sure that a fairly standard rspec-rails setup within a rails

features/support/env.rb

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,6 @@ def call(env)
5353
skip_this_scenario unless SimpleCov.branch_coverage_supported?
5454
end
5555

56-
Before("@rails6") do
57-
# Rails 6 only supports Ruby 2.5+
58-
skip_this_scenario if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.5")
59-
end
60-
61-
Before("@ruby26") do
62-
# oneshot_lines coverage is supported by Ruby 2.6+
63-
skip_this_scenario if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.6")
64-
end
65-
6656
Before("@process_fork") do
6757
# Process.fork is NotImplementedError in jruby
6858
skip_this_scenario if jruby?

lib/simplecov.rb

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -354,33 +354,9 @@ def initial_setup(profile, &block)
354354
# With Negative branch it supports only line coverage measurement type
355355
#
356356
def start_coverage_measurement
357-
# This blog post gives a good run down of the coverage criterias introduced
358-
# in Ruby 2.5: https://blog.bigbinary.com/2018/04/11/ruby-2-5-supports-measuring-branch-and-method-coverages.html
359-
# There is also a nice writeup of the different coverage criteria made in this
360-
# comment https://github.com/simplecov-ruby/simplecov/pull/692#discussion_r281836176 :
361-
# Ruby < 2.5:
362-
# https://github.com/ruby/ruby/blob/v1_9_3_374/ext/coverage/coverage.c
363-
# traditional mode (Array)
364-
#
365-
# Ruby 2.5:
366-
# https://bugs.ruby-lang.org/issues/13901
367-
# https://github.com/ruby/ruby/blob/v2_5_3/ext/coverage/coverage.c
368-
# default: traditional/compatible mode (Array)
369-
# :lines - like traditional mode but using Hash
370-
# :branches
371-
# :methods
372-
# :all - same as lines + branches + methods
373-
#
374-
# Ruby >= 2.6:
375-
# https://bugs.ruby-lang.org/issues/15022
376-
# https://github.com/ruby/ruby/blob/v2_6_3/ext/coverage/coverage.c
377-
# default: traditional/compatible mode (Array)
378-
# :lines - like traditional mode but using Hash
379-
# :branches
380-
# :methods
381-
# :oneshot_lines - can not be combined with lines
382-
# :all - same as lines + branches + methods
383-
#
357+
# CRuby's `Coverage.start` accepts a criteria hash since 2.5; alternate
358+
# engines (older JRuby/TruffleRuby) may still ship the no-arg form, so
359+
# fall back when the runtime doesn't accept arguments.
384360
if coverage_start_arguments_supported?
385361
start_coverage_with_criteria
386362
else

lib/simplecov/simulate_coverage.rb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@ module SimulateCoverage
88
module_function
99

1010
#
11-
# Simulate normal file coverage report on
12-
# ruby 2.5 and return similar hash with lines and branches keys
13-
#
14-
# Happens when a file wasn't required but still tracked.
11+
# Simulate a file coverage report for a file that was tracked but never
12+
# required. Returns the same hash shape as `Coverage.result` (lines,
13+
# branches, methods).
1514
#
1615
# @return [Hash]
1716
#

spec/result_adapter_spec.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010

1111
describe "with oneshot_lines coverage" do
1212
before do
13-
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.6") || RUBY_ENGINE == "truffleruby"
14-
skip "oneshot_lines coverage not supported"
15-
end
13+
skip "oneshot_lines coverage not supported on truffleruby" if RUBY_ENGINE == "truffleruby"
1614
end
1715

1816
context "when all tracked files exist" do

0 commit comments

Comments
 (0)