Skip to content

Commit

Permalink
V3/version deps (#579)
Browse files Browse the repository at this point in the history
* Bump max permissible version of cucumber to v9.x and update minimum rubocop versions for a variety of gems

* Update changelogs

* Downgrade some gems and remove lockfile to attempt to get a partial gem update to work - See: rubygems/rubygems#7044

* Permit v9 of cucumber again

* Permit cucumber v9 in rails 6.1 testing

* Remove final 2 issues we guard around (1 is redundant, 1 has been fixed)

* Remove duplicate step from codebase, use aruba

* Remove small file and absorb into env.rb

* Lean on aruba command for features

* Add changelog

* Add max version restrictions for some of the older rails gems now 7.1 has been released

* Ensure no args are passed downstream

* This class was removed from the stdlib around ruby 1.9.3

* Add matrix gem in to mitigate slightly older capybara issues

* Pass in a Minitest run-name if needed

* Manually overload the matrix require until 3.36+ of capybara is the min

* Update rails 6.1 gemfile to use a slightly higher version of capybara

* Add 2 more workflows to the exclusion list (One will be flaky with psych, the other with capybara)

* ACtually exclude the runs desired
  • Loading branch information
luke-hill committed Oct 13, 2023
1 parent 9bdbad6 commit 9879b81
Show file tree
Hide file tree
Showing 20 changed files with 56 additions and 68 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,16 @@ jobs:
- { ruby: '2.7', gemfile: 'rails_7_1' }
# Ruby 3+ won't work with Rails 5.2: https://github.com/rails/rails/issues/40938
- { ruby: '3.0', gemfile: 'rails_5_2' }
# Capybara has an incompatibility here with rails 6. It's easier to just exclude this one run from the matrix until it's out of support
- { ruby: '3.0', gemfile: 'rails_6_0' }
- { ruby: '3.0', gemfile: 'rails_6_1' }
- { ruby: '3.1', gemfile: 'rails_5_2' }
# Ruby 3.1+ has a conflicting Psych version with Rails 6.0 (And maybe 6.1...): https://stackoverflow.com/questions/71191685/visit-psych-nodes-alias-unknown-alias-default-psychbadalias
# Ruby 3.1+ has a conflicting Psych version with Rails 6.x: https://stackoverflow.com/questions/71191685/visit-psych-nodes-alias-unknown-alias-default-psychbadalias
- { ruby: '3.1', gemfile: 'rails_6_0' }
- { ruby: '3.1', gemfile: 'rails_6_1' }
- { ruby: '3.2', gemfile: 'rails_5_2' }
- { ruby: '3.2', gemfile: 'rails_6_0' }
- { ruby: '3.2', gemfile: 'rails_6_1' }
env:
BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
steps:
Expand Down
13 changes: 0 additions & 13 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,6 @@ Layout/LineLength:
- '^When'
- '^Then'

# This needs fixing as it's inheriting a lot more than what we originally need.
# The inheritance chain goes all the way down to a single test case which the world
# definitely doesn't represent. GH issue 505
Lint/MissingSuper:
Exclude:
- lib/cucumber/rails/world.rb

# These can both be removed once we upgrade rubocop and rubocop-rspec to more up to date versions
Metrics/BlockLength:
Exclude:
- './spec/**/*_spec.rb'
- 'cucumber-rails.gemspec'

# This allows us to read the chmod action in a more reproducible way
Style/NumericLiteralPrefix:
EnforcedOctalStyle: zero_only
Expand Down
8 changes: 6 additions & 2 deletions Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ end

appraise 'rails_6_0' do
gem 'activerecord'
gem 'capybara', '< 3.35'
gem 'cucumber', '< 6'
gem 'matrix' # Until capybara 3.36+
gem 'psych', '< 4'
gem 'rails-html-sanitizer', '< 1.4.3'
gem 'railties', '~> 6.0.3'
Expand All @@ -21,15 +23,17 @@ end

appraise 'rails_6_1' do
gem 'activerecord'
gem 'cucumber', '< 9'
gem 'capybara', '< 3.38'
gem 'cucumber', '< 10'
gem 'psych', '< 4'
gem 'railties', '~> 6.1.3'
gem 'sqlite3', '~> 1.4'
end

appraise 'rails_7_0' do
gem 'activerecord'
gem 'railties', '~> 7.0.0'
gem 'cucumber', '< 10'
gem 'railties', '~> 7.0.0'
gem 'sqlite3', '~> 1.4'
end

Expand Down
10 changes: 5 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ This file is intended to be modified using the [`changelog`](github.com/cucumber

### Fixed
- Some of the rails 5.2 tests were installing lots of old conflicting gems ([luke-hill])
- Generator updates:
- Updated the install locations for some scripts from `script/` to `bin/`
- Changed some install generators to remove some legacy items
- Updates have facilitated minimum support versions altering: capybara must be `v3.11+` and cucumber must be `v5+`
([luke-hill])
- Generator updates (Updated the install locations for some scripts from `script/` to `bin/` and remove some legacy items)
([luke-hill])
- Update minimum versions of several gems: capybara must be `v3.11+` and cucumber must be `v5+` (cucumber v9 is also permissible)
([luke-hill])
- Fixed an issue where the World instantiation didn't re-run the inherited classes initializer ([luke-hill])

## [3.0.0.rc.1] - 2023-09-15
### Removed
Expand Down
13 changes: 7 additions & 6 deletions cucumber-rails.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ Gem::Specification.new do |s|

s.license = 'MIT'

s.required_ruby_version = '>= 2.6.0'
s.required_rubygems_version = '>= 3.2.3'

s.metadata = {
'bug_tracker_uri' => 'https://github.com/cucumber/cucumber-rails/issues',
'changelog_uri' => "https://github.com/cucumber/cucumber-rails/blob/v#{s.version}/CHANGELOG.md",
Expand All @@ -22,7 +25,7 @@ Gem::Specification.new do |s|
}

s.add_runtime_dependency('capybara', '>= 3.11', '< 4')
s.add_runtime_dependency('cucumber', '>= 5', '< 9')
s.add_runtime_dependency('cucumber', '>= 5', '< 10')
s.add_runtime_dependency('railties', '>= 5.2', '< 8')

# Main development dependencies
Expand All @@ -33,16 +36,14 @@ Gem::Specification.new do |s|
s.add_development_dependency('rails', '>= 5.2', '< 8')
s.add_development_dependency('rake', '>= 12.0')
s.add_development_dependency('rspec', '~> 3.6')
s.add_development_dependency('rubocop', '~> 1.28.2')
s.add_development_dependency('rubocop', '~> 1.31.0')
s.add_development_dependency('rubocop-packaging', '~> 0.5.1')
s.add_development_dependency('rubocop-performance', '~> 1.13.3')
s.add_development_dependency('rubocop-rspec', '~> 2.10.0')
s.add_development_dependency('rubocop-performance', '~> 1.17.0')
s.add_development_dependency('rubocop-rspec', '~> 2.12.0')

# For Documentation:
s.add_development_dependency('yard', '~> 0.9.10')

s.required_ruby_version = '>= 2.6.0'
s.required_rubygems_version = '>= 3.2.3'
s.require_path = 'lib'
s.files = Dir['lib/**/*', 'CHANGELOG.md', 'CONTRIBUTING.md', 'LICENSE', 'README.md']
end
2 changes: 1 addition & 1 deletion features/allow_rescue.feature
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Feature: Allow Cucumber to rescue exceptions
"""
And I run `bundle exec rake db:migrate`
And I run `bundle exec cucumber`
Then the feature run should pass with:
Then the feature should pass with:
"""
1 scenario (1 passed)
2 steps (2 passed)
Expand Down
8 changes: 4 additions & 4 deletions features/capybara_javascript_drivers.feature
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Feature: Capybara Javascript Drivers
"""
And I run `bundle exec rake db:migrate`
And I run `bundle exec rake cucumber`
Then the feature run should pass with:
Then the feature should pass with:
"""
1 scenario (1 passed)
6 steps (6 passed)
Expand Down Expand Up @@ -87,7 +87,7 @@ Feature: Capybara Javascript Drivers
"""
And I run `bundle exec rake db:migrate`
And I run `bundle exec rake cucumber`
Then the feature run should pass with:
Then the feature should pass with:
"""
1 scenario (1 passed)
6 steps (6 passed)
Expand Down Expand Up @@ -126,7 +126,7 @@ Feature: Capybara Javascript Drivers
"""
And I run `bundle exec rake db:migrate`
And I run `bundle exec rake cucumber`
Then the feature run should pass with:
Then the feature should pass with:
"""
1 scenario (1 passed)
3 steps (3 passed)
Expand Down Expand Up @@ -176,7 +176,7 @@ Feature: Capybara Javascript Drivers
"""
And I run `bundle exec rake db:migrate`
And I run `bundle exec rake cucumber`
Then the feature run should pass with:
Then the feature should pass with:
"""
1 scenario (1 passed)
6 steps (6 passed)
Expand Down
16 changes: 8 additions & 8 deletions features/choose_javascript_database_strategy.feature
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ Feature: Choose javascript database strategy
Then the DatabaseCleaner strategy should be transaction
And I should have 2 widgets
"""
And I run the cukes
Then the feature run should pass with:
And I run `bundle exec cucumber`
Then the feature should pass with:
"""
3 scenarios (3 passed)
10 steps (10 passed)
Expand All @@ -97,8 +97,8 @@ Feature: Choose javascript database strategy
Scenario:
Then I should have 2 widgets
"""
And I run the cukes
Then the feature run should pass with:
And I run `bundle exec cucumber`
Then the feature should pass with:
"""
2 scenarios (2 passed)
5 steps (5 passed)
Expand Down Expand Up @@ -126,8 +126,8 @@ Feature: Choose javascript database strategy
Then I should have 2 widgets
And the DatabaseCleaner strategy should be transaction
"""
And I run the cukes
Then the feature run should pass with:
And I run `bundle exec cucumber`
Then the feature should pass with:
"""
2 scenarios (2 passed)
7 steps (7 passed)
Expand All @@ -149,8 +149,8 @@ Feature: Choose javascript database strategy
Scenario:
Then I should have 3 widgets
"""
And I run the cukes
Then the feature run should pass with:
And I run `bundle exec cucumber`
Then the feature should pass with:
"""
2 scenarios (2 passed)
3 steps (3 passed)
Expand Down
4 changes: 2 additions & 2 deletions features/configuration.feature
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Feature: Cucumber Rails Configuration
end
"""
And I run `bundle exec rake cucumber`
Then the feature run should pass with:
Then the feature should pass with:
"""
1 scenario (1 passed)
1 step (1 passed)
Expand All @@ -41,7 +41,7 @@ Feature: Cucumber Rails Configuration
end
"""
And I run `bundle exec rake cucumber`
Then the feature run should pass with:
Then the feature should pass with:
"""
1 scenario (1 passed)
1 step (1 passed)
Expand Down
6 changes: 3 additions & 3 deletions features/database_cleaner.feature
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Feature: Database Cleaner
"""
And I run `bundle exec rake db:migrate`
And I run `bundle exec rake cucumber`
Then the feature run should pass with:
Then the feature should pass with:
"""
2 scenarios (2 passed)
6 steps (6 passed)
Expand Down Expand Up @@ -80,7 +80,7 @@ Feature: Database Cleaner
"""
And I run `bundle exec rake db:migrate`
And I run `bundle exec rake cucumber`
Then the feature run should pass with:
Then the feature should pass with:
"""
2 scenarios (2 passed)
6 steps (6 passed)
Expand Down Expand Up @@ -124,7 +124,7 @@ Feature: Database Cleaner
"""
And I run `bundle exec rake db:migrate`
And I run `bundle exec rake cucumber`
Then the feature run should pass with:
Then the feature should pass with:
"""
2 scenarios (2 passed)
6 steps (6 passed)
Expand Down
2 changes: 1 addition & 1 deletion features/disable_automatic_database_cleaning.feature
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Feature: Disable automatic database cleaning
"""
And I run `bundle exec rake db:migrate`
And I run `bundle exec rake cucumber`
Then the feature run should pass with:
Then the feature should pass with:
"""
2 scenarios (2 passed)
4 steps (4 passed)
Expand Down
4 changes: 2 additions & 2 deletions features/emulate_javascript.feature
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Feature: Emulate Javascript
"""
And I run `bundle exec rake db:migrate`
And I run `bundle exec rake cucumber`
Then the feature run should pass with:
Then the feature should pass with:
"""
1 scenario (1 passed)
3 steps (3 passed)
Expand Down Expand Up @@ -118,7 +118,7 @@ Feature: Emulate Javascript
"""
And I run `bundle exec rake db:migrate`
And I run `bundle exec rake cucumber`
Then the feature run should pass with:
Then the feature should pass with:
"""
1 scenario (1 passed)
9 steps (9 passed)
Expand Down
2 changes: 1 addition & 1 deletion features/rest_api.feature
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Feature: REST API
"""
And I run `bundle exec rake db:migrate`
And I run `bundle exec rake cucumber`
Then the feature run should pass with:
Then the feature should pass with:
"""
1 scenario (1 passed)
2 steps (2 passed)
Expand Down
12 changes: 0 additions & 12 deletions features/step_definitions/cucumber_rails_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,3 @@

overwrite_file(file, content.gsub(/\.(datetime|time|date)_field/, '.\1_select'))
end

When('I run the cukes') do
run_command_and_stop('bundle exec cucumber')
end

# Copied from Aruba
Then('the feature run should pass with:') do |string|
step 'the output should not contain " failed)"'
step 'the output should not contain " undefined)"'
step 'the exit status should be 0'
step 'the output should contain:', string
end
5 changes: 0 additions & 5 deletions features/support/aruba.rb

This file was deleted.

4 changes: 4 additions & 0 deletions features/support/env.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@

require 'rspec/expectations'
require 'aruba/cucumber'

Aruba.configure do |config|
config.exit_timeout = 360
end
2 changes: 2 additions & 0 deletions gemfiles/rails_6_0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
source "https://rubygems.org"

gem "activerecord"
gem "capybara", "< 3.35"
gem "cucumber", "< 6"
gem "matrix"
gem "psych", "< 4"
gem "rails-html-sanitizer", "< 1.4.3"
gem "railties", "~> 6.0.3"
Expand Down
3 changes: 2 additions & 1 deletion gemfiles/rails_6_1.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
source "https://rubygems.org"

gem "activerecord"
gem "cucumber", "< 9"
gem "capybara", "< 3.38"
gem "cucumber", "< 10"
gem "psych", "< 4"
gem "railties", "~> 6.1.3"
gem "sqlite3", "~> 1.4"
Expand Down
1 change: 1 addition & 0 deletions gemfiles/rails_7_0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
source "https://rubygems.org"

gem "activerecord"
gem "cucumber", "< 10"
gem "railties", "~> 7.0.0"
gem "sqlite3", "~> 1.4"

Expand Down
2 changes: 1 addition & 1 deletion lib/cucumber/rails/world.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class World < ::ActionDispatch::IntegrationTest
include ActiveSupport::Testing::SetupAndTeardown if ActiveSupport::Testing.const_defined?(:SetupAndTeardown)

def initialize
@_result = Test::Unit::TestResult.new if defined?(Test::Unit::TestResult)
super('MiniTest run-name if needed')
end

unless defined?(ActiveRecord::Base)
Expand Down

0 comments on commit 9879b81

Please sign in to comment.