Skip to content

Commit 19b1193

Browse files
authored
Fix scenario grouping with Rules (#877)
* Fix scenario grouping with Rules Updated the scenario detection logic when grouping by scenarios so that it can handle test that are nested under Rules. * Update CHANGELOG Added the scenario grouping Rule fix to the change log. * Fix Rubocop violations Fixed Rubocop violations introduced in the recent commits. * Add development dependencies to gemspec Moving some gems that are definitely needed to develop and test the gem into their proper section of the gemspec instead of them only existing in the development gemfile. * Test against various dependency versions in CI Updated the CI matrix so that the gem is tested against several different versions of its potential runtime dependencies. * Ignore some IDE files Ignoring Jetbrains IDE files. * Fix CI gemfile isues Fixing the paths to the gemspec and the Rubocop task not even having a gemfile specified. * Fix Rubocop violations Fixed Rubocop violations introduced in the recent commits. * Exclude bad CI combinations Not testing against some incompatible dependency combinations. * Fix typo in CI config Fixed a copy/paste mistake. * Fix another typo in CI config Fixed another copy/paste mistake. * Update minimum supported CukeModeler version Removing CukeModeler 2.x from CI testing because this gem requires at least CukeModeler 3.x. * Handle Cucumber Rules better Added a condition to some Rule logic so that older versions of CukeModeler that don't use Rules will still work. * Fix Rubocop violations Fixed Rubocop violations that are showing up in the newer version of Rubocop that is being used in CI. * Fix a test Fixed a test that was using an unreliable way of determining the root directory of the repository. * Remove Cucumber 3 from CI tests Not testing against Cucumber 3 because it has lots of failures and I don't know if it is even officially supported by this gem anymore. * Fix more Rubocop violations Fixed more Rubocop violations that are showing up in the newer version of Rubocop that is being used in CI. * Make a test conditional Not running a test for versions of dependencies for which it is not applicable. * Re-lock dependencies Locking down Cucumber and CukeModeler to their previous version limits because there are lots of test failures in CI for versions that I don't know if this gem even supports.
1 parent 67fc2e0 commit 19b1193

File tree

17 files changed

+139
-29
lines changed

17 files changed

+139
-29
lines changed

.github/workflows/test.yml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,25 @@ jobs:
1212
matrix:
1313
ruby: ['2.5', '2.6', '2.7', '3.0', '3.1', head, jruby-head]
1414
os: [ubuntu-latest, windows-latest]
15+
gemfile: [cucumber_4, cuke_modeler_3_minimum, cuke_modeler_3]
1516
task: [spec]
1617
include:
17-
- ruby: '2.5' # lowest supported version
18-
os: ubuntu-latest
19-
task: rubocop
18+
- ruby: '2.5' # lowest supported version
19+
os: ubuntu-latest
20+
gemfile: cuke_modeler_3 # Any one of the gemfiles should be fine
21+
task: rubocop
22+
exclude:
23+
# CukeModeler 3.x does not support Ruby 3 until CM 3.6
24+
- gemfile: cuke_modeler_3_minimum
25+
ruby: jruby-head
26+
- gemfile: cuke_modeler_3_minimum
27+
ruby: head
28+
- gemfile: cuke_modeler_3_minimum
29+
ruby: '3.1'
30+
- gemfile: cuke_modeler_3_minimum
31+
ruby: '3.0'
32+
env: # $BUNDLE_GEMFILE must be set at the job level, so that it is set for all steps
33+
BUNDLE_GEMFILE: ci_gemfiles/${{ matrix.gemfile }}.gemfile
2034
steps:
2135
- uses: actions/checkout@master
2236
- uses: ruby/setup-ruby@v1

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
tmp
33
.bundle
44
**/vendor/bundle
5+
/.idea

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
### Fixed
1010

11+
- Grouping by scenarios now works for tests that are nested under Rules.
12+
1113
## 3.11.0 - 2022-05-27
1214

1315
### Changed

Gemfile

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,4 @@ gemspec
55
gem 'bump'
66
gem 'test-unit'
77
gem 'minitest', '~> 5.5.0'
8-
gem 'rspec', '~> 3.3'
9-
gem 'cucumber', "~> 4.0"
10-
gem 'cuke_modeler', '~> 3.0'
118
gem 'spinach', git: "https://github.com/grosser/spinach.git", branch: "grosser/json" # https://github.com/codegram/spinach/pull/229
12-
gem 'rake'
13-
gem 'rubocop'

Gemfile.lock

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,16 @@ GEM
6262
cucumber-gherkin (< 23.0)
6363
diff-lcs (1.3)
6464
ffi (1.15.5)
65+
ffi (1.15.5-x64-mingw32)
6566
gherkin-ruby (0.3.2)
6667
i18n (1.10.0)
6768
concurrent-ruby (~> 1.0)
69+
json (2.6.2)
6870
middleware (0.1.0)
6971
minitest (5.5.1)
7072
multi_test (0.1.2)
7173
parallel (1.22.1)
72-
parser (3.1.1.0)
74+
parser (3.1.2.1)
7375
ast (~> 2.4.1)
7476
power_assert (2.0.1)
7577
protobuf-cucumber (3.10.8)
@@ -79,7 +81,7 @@ GEM
7981
thread_safe
8082
rainbow (3.1.1)
8183
rake (13.0.6)
82-
regexp_parser (2.2.1)
84+
regexp_parser (2.5.0)
8385
rexml (3.2.5)
8486
rspec (3.11.0)
8587
rspec-core (~> 3.11.0)
@@ -94,16 +96,17 @@ GEM
9496
diff-lcs (>= 1.2.0, < 2.0)
9597
rspec-support (~> 3.11.0)
9698
rspec-support (3.11.0)
97-
rubocop (1.26.1)
99+
rubocop (1.35.1)
100+
json (~> 2.3)
98101
parallel (~> 1.10)
99-
parser (>= 3.1.0.0)
102+
parser (>= 3.1.2.1)
100103
rainbow (>= 2.2.2, < 4.0)
101104
regexp_parser (>= 1.8, < 3.0)
102-
rexml
103-
rubocop-ast (>= 1.16.0, < 2.0)
105+
rexml (>= 3.2.5, < 4.0)
106+
rubocop-ast (>= 1.20.1, < 2.0)
104107
ruby-progressbar (~> 1.7)
105108
unicode-display_width (>= 1.4.0, < 3.0)
106-
rubocop-ast (1.16.0)
109+
rubocop-ast (1.21.0)
107110
parser (>= 3.1.1.0)
108111
ruby-progressbar (1.11.0)
109112
sys-uname (1.2.2)
@@ -114,11 +117,12 @@ GEM
114117
thread_safe (0.3.6)
115118
tzinfo (2.0.4)
116119
concurrent-ruby (~> 1.0)
117-
unicode-display_width (2.1.0)
120+
unicode-display_width (2.2.0)
118121
zeitwerk (2.5.4)
119122

120123
PLATFORMS
121124
ruby
125+
x64-mingw32
122126

123127
DEPENDENCIES
124128
bump
@@ -133,4 +137,4 @@ DEPENDENCIES
133137
test-unit
134138

135139
BUNDLED WITH
136-
2.3.7
140+
2.3.6

Rakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ end
1919

2020
desc "bundle all gemfiles [EXTRA=]"
2121
task :bundle_all do
22-
extra = ENV["EXTRA"] || "install"
22+
extra = ENV.fetch("EXTRA", nil) || "install"
2323

2424
gemfiles = (["Gemfile"] + Dir["spec/fixtures/rails*/Gemfile"])
2525
raise if gemfiles.size < 3

ci_gemfiles/cucumber_4.gemfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# frozen_string_literal: true
2+
source 'https://rubygems.org'
3+
gemspec path: "../"
4+
5+
gem 'bump'
6+
gem 'test-unit'
7+
gem 'minitest', '~> 5.5.0'
8+
gem 'spinach', git: "https://github.com/grosser/spinach.git", branch: "grosser/json" # https://github.com/codegram/spinach/pull/229
9+
10+
# The version of Cucumber being tested
11+
gem 'cucumber', '~> 4.0'

ci_gemfiles/cuke_modeler_3.gemfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# frozen_string_literal: true
2+
source 'https://rubygems.org'
3+
gemspec path: "../"
4+
5+
gem 'bump'
6+
gem 'test-unit'
7+
gem 'minitest', '~> 5.5.0'
8+
gem 'spinach', git: "https://github.com/grosser/spinach.git", branch: "grosser/json" # https://github.com/codegram/spinach/pull/229
9+
10+
# The version of CukeModeler being tested
11+
gem 'cuke_modeler', '~> 3.0'
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# frozen_string_literal: true
2+
source 'https://rubygems.org'
3+
gemspec path: "../"
4+
5+
gem 'bump'
6+
gem 'test-unit'
7+
gem 'minitest', '~> 5.5.0'
8+
gem 'spinach', git: "https://github.com/grosser/spinach.git", branch: "grosser/json" # https://github.com/codegram/spinach/pull/229
9+
10+
# The version of CukeModeler being tested
11+
gem 'cuke_modeler', '3.0.0'

lib/parallel_tests.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class << self
1616
def determine_number_of_processes(count)
1717
[
1818
count,
19-
ENV["PARALLEL_TEST_PROCESSORS"],
19+
ENV.fetch("PARALLEL_TEST_PROCESSORS", nil),
2020
Parallel.processor_count
2121
].detect { |c| !c.to_s.strip.empty? }.to_i
2222
end
@@ -68,8 +68,8 @@ def first_process?
6868
end
6969

7070
def last_process?
71-
current_process_number = ENV['TEST_ENV_NUMBER']
72-
total_processes = ENV['PARALLEL_TEST_GROUPS']
71+
current_process_number = ENV.fetch('TEST_ENV_NUMBER', nil)
72+
total_processes = ENV.fetch('PARALLEL_TEST_GROUPS', nil)
7373
return true if current_process_number.nil? && total_processes.nil?
7474
current_process_number = '1' if current_process_number.nil?
7575
current_process_number == total_processes

0 commit comments

Comments
 (0)