From 6926aa0503947697435cac65a995891a4cf0d111 Mon Sep 17 00:00:00 2001 From: Michael Grosser Date: Sat, 24 Sep 2022 07:12:42 +0200 Subject: [PATCH] drop ruby 2.5 (#881) --- .github/workflows/test.yml | 4 ++-- .rubocop.yml | 2 +- lib/parallel_tests/cli.rb | 4 ++-- lib/parallel_tests/cucumber/scenario_line_logger.rb | 2 +- lib/parallel_tests/gherkin/runner.rb | 2 +- lib/parallel_tests/grouper.rb | 2 +- parallel_tests.gemspec | 2 +- spec/parallel_tests/rspec/runner_spec.rb | 2 +- spec/parallel_tests/test/runner_spec.rb | 2 +- spec/spec_helper.rb | 2 +- 10 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9ebb95ed..acf5ba58 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,11 +10,11 @@ jobs: strategy: fail-fast: false # run all tests so we see which gem/ruby combinations break matrix: - ruby: ['2.5', '2.6', '2.7', '3.0', '3.1', head, jruby-head] + ruby: ['2.6', '2.7', '3.0', '3.1', head, jruby-head] os: [ubuntu-latest, windows-latest] task: [spec] include: - - ruby: '2.5' # lowest supported version + - ruby: '2.6' # lowest supported version, same as gemspec and .rubocop.yml os: ubuntu-latest task: rubocop steps: diff --git a/.rubocop.yml b/.rubocop.yml index 7c49c081..d69035e3 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,6 +1,6 @@ AllCops: NewCops: enable - TargetRubyVersion: 2.5 + TargetRubyVersion: 2.6 SuggestExtensions: false Exclude: - '**/vendor/bundle/**/*' diff --git a/lib/parallel_tests/cli.rb b/lib/parallel_tests/cli.rb index 5c3e1864..8c3872c4 100644 --- a/lib/parallel_tests/cli.rb +++ b/lib/parallel_tests/cli.rb @@ -316,12 +316,12 @@ def parse_options!(argv) def extract_file_paths(argv) dash_index = argv.rindex("--") file_args_at = (dash_index || -1) + 1 - [argv[file_args_at..-1], argv[0...(dash_index || 0)]] + [argv[file_args_at..], argv[0...(dash_index || 0)]] end def extract_test_options(argv) dash_index = argv.index("--") || -1 - argv[dash_index + 1..-1] + argv[dash_index + 1..] end def append_test_options(options, argv) diff --git a/lib/parallel_tests/cucumber/scenario_line_logger.rb b/lib/parallel_tests/cucumber/scenario_line_logger.rb index 74a99b52..bd47b7ad 100644 --- a/lib/parallel_tests/cucumber/scenario_line_logger.rb +++ b/lib/parallel_tests/cucumber/scenario_line_logger.rb @@ -27,7 +27,7 @@ def visit_feature_element(uri, feature_element, feature_tags, line_numbers: []) example_tags = example.tags.map(&:name) example_tags = scenario_tags + example_tags next unless matches_tags?(example_tags) - example.rows[1..-1].each do |row| + example.rows[1..].each do |row| test_line = row.source_line next if line_numbers.any? && !line_numbers.include?(test_line) diff --git a/lib/parallel_tests/gherkin/runner.rb b/lib/parallel_tests/gherkin/runner.rb index b41463a3..a3508fba 100644 --- a/lib/parallel_tests/gherkin/runner.rb +++ b/lib/parallel_tests/gherkin/runner.rb @@ -57,7 +57,7 @@ def summarize_results(results) plural = "s" if (word == group) && (number != 1) "#{number} #{word}#{plural}" end - "#{sums[0]} (#{sums[1..-1].join(", ")})" + "#{sums[0]} (#{sums[1..].join(", ")})" end.compact.join("\n") end diff --git a/lib/parallel_tests/grouper.rb b/lib/parallel_tests/grouper.rb index 959339f1..fd2229d9 100644 --- a/lib/parallel_tests/grouper.rb +++ b/lib/parallel_tests/grouper.rb @@ -38,7 +38,7 @@ def in_even_groups_by_size(items, num_groups, options = {}) # add all files that should run in a multiple isolated processes to their own groups group_features_by_size(items_to_group(single_items), groups[0..(isolate_count - 1)]) # group the non-isolated by size - group_features_by_size(items_to_group(items), groups[isolate_count..-1]) + group_features_by_size(items_to_group(items), groups[isolate_count..]) else # add all files that should run in a single non-isolated process to first group single_items.each { |item, size| add_to_group(groups.first, item, size) } diff --git a/parallel_tests.gemspec b/parallel_tests.gemspec index b6d5f3f9..17ac6426 100644 --- a/parallel_tests.gemspec +++ b/parallel_tests.gemspec @@ -17,5 +17,5 @@ Gem::Specification.new name, ParallelTests::VERSION do |s| s.license = "MIT" s.executables = ["parallel_spinach", "parallel_cucumber", "parallel_rspec", "parallel_test"] s.add_runtime_dependency "parallel" - s.required_ruby_version = '>= 2.5.0' + s.required_ruby_version = '>= 2.6.0' end diff --git a/spec/parallel_tests/rspec/runner_spec.rb b/spec/parallel_tests/rspec/runner_spec.rb index 23c20972..bec9f695 100644 --- a/spec/parallel_tests/rspec/runner_spec.rb +++ b/spec/parallel_tests/rspec/runner_spec.rb @@ -180,7 +180,7 @@ def call(*args) def call(*args) base = ["ruby", "-Ilib:test", "test/minitest/test_minitest_unit.rb"] result = ParallelTests::RSpec::Runner.command_with_seed([*base, *args], "555") - result[base.length..-1] + result[base.length..] end it "adds the randomized seed" do diff --git a/spec/parallel_tests/test/runner_spec.rb b/spec/parallel_tests/test/runner_spec.rb index a3f15cc3..d3b07831 100644 --- a/spec/parallel_tests/test/runner_spec.rb +++ b/spec/parallel_tests/test/runner_spec.rb @@ -610,7 +610,7 @@ def run_with_file(content) def call(*args) base = ["ruby", "-Ilib:test", "test/minitest/test_minitest_unit.rb"] result = ParallelTests::Test::Runner.command_with_seed([*base, *args], "555") - result[base.length..-1] + result[base.length..] end it "adds the randomized seed" do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 405d93d0..b327c6f4 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -84,7 +84,7 @@ def test_tests_in_groups(klass, suffix) def setup_runtime_log # rubocop:disable Lint/NestedMethodDefinition File.open(log, 'w') do |f| - @files[1..-1].each { |file| f.puts "#{file}:#{@files.index(file)}" } + @files[1..].each { |file| f.puts "#{file}:#{@files.index(file)}" } f.puts "#{@files[0]}:10" end end