Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest
environment: Release
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: cucumber/[email protected]
with:
rubygems_api_key: ${{ secrets.RUBYGEMS_API_KEY }}
Expand All @@ -31,7 +31,7 @@ jobs:
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: cucumber/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
7 changes: 2 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,24 @@ jobs:
# - rails versions if their patch release is within 6 months of the Ruby EOL date
# - No version of the current rails major
#
# 3.1 -> EOL Mar '25 -> Only test Rails versions initially released before Sep '25
# 3.2 -> EOL Mar '26 -> Only test Rails versions initially released before Sep '26
include:
- { ruby: '3.4', gemfile: 'rails_7_2' }
- { ruby: '3.4', gemfile: 'rails_8_0' }
# Supported rubies will test all permissible supported rails versions
ruby: ['3.1', '3.2', '3.3']
ruby: ['3.2', '3.3']
gemfile: ['rails_6_1', 'rails_7_0', 'rails_7_1', 'rails_7_2', 'rails_8_0']
exclude:
# Ruby 3.1+ has issues with Rails 6.1 https://github.com/rails/rails/issues/46883#issuecomment-1371325906
# It (Rails 6.1.x), has been marked as a won't fix and as such it's likely this will need to just be excluded until out of support window
# 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
# Rails 8.x has a minimum ruby of 3.2
- { ruby: '3.1', gemfile: 'rails_6_1' }
- { ruby: '3.1', gemfile: 'rails_8_0' }
- { ruby: '3.2', gemfile: 'rails_6_1' }
- { ruby: '3.3', gemfile: 'rails_6_1' }
env:
BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
Expand Down
6 changes: 5 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require:
- rubocop-rspec

AllCops:
TargetRubyVersion: 3.1
TargetRubyVersion: 3.2
NewCops: enable
Exclude:
# These are auto-generated from a load of features that use aruba
Expand All @@ -15,6 +15,10 @@ AllCops:
- 'gemfiles/*.gemfile'
- 'vendor/**/*'

# Stylistic preference to keep dev dependencies in gemspec
Gemspec/DevelopmentDependencies:
Enabled: false

# Disabled on our repo's to enable polyglot-release
Gemspec/RequireMFA:
Enabled: false
Expand Down
4 changes: 4 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ appraise 'rails_6_1' do
gem 'activerecord'
gem 'capybara', '< 3.38'
gem 'concurrent-ruby', '< 1.3.5'
gem 'cucumber', '< 11'
gem 'factory_bot', '< 6.4'
gem 'psych', '< 4'
gem 'railties', '~> 6.1.7'
Expand All @@ -12,6 +13,7 @@ end

appraise 'rails_7_0' do
gem 'activerecord'
gem 'capybara', '< 3.41'
gem 'concurrent-ruby', '< 1.3.5'
gem 'cucumber', '< 10'
gem 'factory_bot', '< 6.6'
Expand All @@ -21,6 +23,8 @@ end

appraise 'rails_7_1' do
gem 'activerecord'
gem 'capybara', '< 3.41'
gem 'cucumber', '< 10'
gem 'railties', '~> 7.1.5'
gem 'sqlite3', '~> 2.0'
end
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
This file is intended to be modified using the [`changelog`](https://github.com/cucumber/changelog) command-line tool.

## [Unreleased]
### Removed
- Removed support for Ruby 2.6 - 3.1 (Ruby 3.2 is now the lowest version)
- Removed support for Rails 5.2 and 6.0 (6.1 is still supported and 7.0+ is preferred)

### Changed
- In-line with minimum ruby / rails, a lot of internal non-breaking refactors have been done to remove legacy code

## [3.1.1] - 2025-01-30
### Changed
Expand Down
16 changes: 13 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,25 @@ namespace :test do
Rake::Task['appraisal'].invoke('test')
end

desc 'Run tests against specified gemfile, e.g. rake test:gemfile[rails_6_0]'
task :gemfile, :name do |_task, args|
desc 'Run tests against specified gemfile, e.g. rake test:gemfile[rails_8_0]'
task :full, :name do |_task, args|
unless args.name && File.exist?("gemfiles/#{args.name}.gemfile")
raise ArgumentError, "You must provide the name of an existing Appraisal gemfile,
e.g. 'rake test:gemfile[rails_6_0]'"
e.g. 'rake test:full[rails_8_0]'"
end

Rake::Task["appraisal:#{args.name}"].invoke('test')
end

desc 'Run unit tests only against specified gemfile, e.g. rake test:gemfile[rails_8_0]'
task :spec, :name do |_task, args|
unless args.name && File.exist?("gemfiles/#{args.name}.gemfile")
raise ArgumentError, "You must provide the name of an existing Appraisal gemfile,
e.g. 'rake test:spec[rails_8_0]'"
end

system "BUNDLE_GEMFILE=/home/luke/Code/cucumber-rails/gemfiles/#{args.name}.gemfile bundle exec rspec"
end
end

namespace :gemfiles do
Expand Down
24 changes: 12 additions & 12 deletions cucumber-rails.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ $LOAD_PATH.unshift File.expand_path('lib', __dir__)
Gem::Specification.new do |s|
s.name = 'cucumber-rails'
s.version = File.read("#{__dir__}/VERSION")
s.authors = ['Aslak Hellesøy', 'Dennis Blöte', 'Rob Holland']
s.authors = ['Aslak Hellesøy', 'Dennis Blöte', 'Rob Holland', 'Luke Hill']
s.description = 'Cucumber Generator and Runtime for Rails'
s.summary = "#{s.name}-#{s.version}"
s.email = '[email protected]'
s.homepage = 'https://cucumber.io'

s.license = 'MIT'

s.required_ruby_version = '>= 3.1.0'
s.required_ruby_version = '>= 3.2.0'
s.required_rubygems_version = '>= 3.2.8'

s.metadata = {
Expand All @@ -24,24 +24,24 @@ Gem::Specification.new do |s|
'source_code_uri' => "https://github.com/cucumber/cucumber-rails/tree/v#{s.version}"
}

s.add_runtime_dependency('capybara', '>= 3.11', '< 4')
s.add_runtime_dependency('cucumber', '>= 5', '< 10')
s.add_runtime_dependency('railties', '>= 5.2', '< 9')
s.add_runtime_dependency('capybara', '>= 3.25', '< 4')
s.add_runtime_dependency('cucumber', '>= 7', '< 11')
s.add_runtime_dependency('railties', '>= 6.1', '< 9')

# Main development dependencies
s.add_development_dependency('ammeter', '>= 1.1.5')
s.add_development_dependency('appraisal', '>= 2.4.1', '< 3')
s.add_development_dependency('aruba', '>= 1.1.2', '< 3')
s.add_development_dependency('aruba', '~> 2.0')
s.add_development_dependency('database_cleaner', '~> 2.0')
s.add_development_dependency('rails', '>= 5.2', '< 9')
s.add_development_dependency('rake', '~> 13.2')
s.add_development_dependency('rails', '>= 6.1', '< 9')
s.add_development_dependency('rake', '~> 13.3')
s.add_development_dependency('rspec', '~> 3.13')
s.add_development_dependency('rubocop', '~> 1.45.0')
s.add_development_dependency('rubocop', '~> 1.62.0')
s.add_development_dependency('rubocop-packaging', '~> 0.5.2')
s.add_development_dependency('rubocop-performance', '~> 1.17.1')
s.add_development_dependency('rubocop-rails', '~> 2.18.0')
s.add_development_dependency('rubocop-performance', '~> 1.22.0')
s.add_development_dependency('rubocop-rails', '~> 2.29.0')
s.add_development_dependency('rubocop-rake', '~> 0.6.0')
s.add_development_dependency('rubocop-rspec', '~> 2.17.0')
s.add_development_dependency('rubocop-rspec', '~> 3.1.0')

# For Documentation:
s.add_development_dependency('yard', '~> 0.9.10')
Expand Down
20 changes: 5 additions & 15 deletions features/support/cucumber_rails_gem_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,17 @@ def add_cucumber_rails(options)
def add_sqlite3_gem
if rails_equal_or_higher_than?('7.1')
add_gem 'sqlite3', '~> 2.0'
elsif rails_equal_or_higher_than?('6.0')
add_gem 'sqlite3', '~> 1.4'
else
add_gem 'sqlite3', '~> 1.3.13'
add_gem 'sqlite3', '~> 1.4'
end
end

def add_selenium_webdriver_gem
if rails_equal_or_higher_than?('7.0')
add_gem 'selenium-webdriver', '~> 4.22', group: :test
elsif rails_equal_or_higher_than?('6.0')
else
add_gem 'selenium-webdriver', '~> 4.0', group: :test
add_gem 'webdrivers', '~> 5.0', group: :test
else
add_gem 'selenium-webdriver', '< 4', group: :test
add_gem 'webdrivers', '~> 4.0', group: :test
remove_gem 'chromedriver-helper'
end
end

Expand All @@ -59,11 +53,7 @@ def add_remaining_gems(options)
add_gem 'capybara', Capybara::VERSION, group: :test
add_gem 'database_cleaner', '>= 2.0.0', group: :test unless options.include?(:no_database_cleaner)
add_gem 'database_cleaner-active_record', '>= 2.0.0', group: :test if options.include?(:database_cleaner_active_record)
if rails_equal_or_higher_than?('6.0')
add_gem 'factory_bot', '>= 6.4', group: :test unless options.include?(:no_factory_bot)
else
add_gem 'factory_bot', '< 6.4', group: :test unless options.include?(:no_factory_bot)
end
add_gem 'factory_bot', '>= 6.4', group: :test unless options.include?(:no_factory_bot)
add_gem 'rspec-expectations', '~> 3.12', group: :test
end

Expand All @@ -86,8 +76,8 @@ def remove_gem(name)
overwrite_file('Gemfile', content)
end

def add_gem(name, *args)
line = convert_gem_opts_to_string(name, *args)
def add_gem(name, *)
line = convert_gem_opts_to_string(name, *)
gem_regexp = /gem ["']#{name}["'].*$/
gemfile_content = File.read(expand_path('Gemfile'))

Expand Down
8 changes: 2 additions & 6 deletions features/support/cucumber_rails_setup_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ def rails_new(options = {})

def run_rails_new_command(options)
flags = %w[--skip-action-cable --skip-action-mailer --skip-active-job --skip-bootsnap --skip-bundle --skip-javascript
--skip-jbuilder --skip-listen --skip-spring --skip-sprockets --skip-test-unit --skip-turbolinks --skip-active-storage]
flags += %w[--skip-action-mailbox --skip-action-text] if rails_equal_or_higher_than?('6.0')
--skip-jbuilder --skip-listen --skip-spring --skip-sprockets --skip-test-unit --skip-turbolinks
--skip-active-storage --skip-action-mailbox --skip-action-text]
run_command "bundle exec rails new test_app #{flags.join(' ')} #{options[:args]}"
end

Expand All @@ -43,10 +43,6 @@ def clear_bundle_env_vars
unset_bundler_env_vars
delete_environment_variable 'BUNDLE_GEMFILE'
end

def rails_equal_or_higher_than?(version)
Rails.gem_version >= Gem::Version.new(version)
end
end

World(CucumberRailsSetupHelper)
1 change: 1 addition & 0 deletions gemfiles/rails_6_1.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ source "https://rubygems.org"
gem "activerecord"
gem "capybara", "< 3.38"
gem "concurrent-ruby", "< 1.3.5"
gem "cucumber", "< 11"
gem "factory_bot", "< 6.4"
gem "psych", "< 4"
gem "railties", "~> 6.1.7"
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 "capybara", "< 3.41"
gem "concurrent-ruby", "< 1.3.5"
gem "cucumber", "< 10"
gem "factory_bot", "< 6.6"
Expand Down
2 changes: 2 additions & 0 deletions gemfiles/rails_7_1.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
source "https://rubygems.org"

gem "activerecord"
gem "capybara", "< 3.41"
gem "cucumber", "< 10"
gem "railties", "~> 7.1.5"
gem "sqlite3", "~> 2.0"

Expand Down
2 changes: 1 addition & 1 deletion lib/cucumber/rails/action_dispatch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def call(env)

show_exceptions = !env['action_dispatch.show_detailed_exceptions']
if ::Rails.gem_version >= Gem::Version.new('7.1.0')
# Rails 7.1 deprecated `show_exceptions` boolean in in favor of symbols
# Rails 7.1 deprecated `show_exceptions` boolean in favour of symbols
show_exceptions = show_exceptions ? :all : :none
end

Expand Down
2 changes: 1 addition & 1 deletion lib/cucumber/rails/database/deletion_strategy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Rails
module Database
class DeletionStrategy < Strategy
def before_js
super :deletion
super(:deletion)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/cucumber/rails/database/strategy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def initialize(options = {})
end

def before_js(strategy)
@original_strategy = if defined?(DatabaseCleaner::VERSION) && Gem::Version.new(DatabaseCleaner::VERSION) >= Gem::Version.new('1.8.0.beta')
@original_strategy = if defined?(DatabaseCleaner) && Gem::Version.new(DatabaseCleaner::VERSION) >= Gem::Version.new('1.8.0')
raise "No DatabaseCleaner strategies found. Make sure you have required one of DatabaseCleaner's adapters" if DatabaseCleaner.cleaners.empty?

DatabaseCleaner.cleaners.values.first.strategy # that feels like a nasty hack
Expand Down
2 changes: 1 addition & 1 deletion lib/cucumber/rails/database/truncation_strategy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Rails
module Database
class TruncationStrategy < Strategy
def before_js
super :truncation
super(:truncation)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/generators/cucumber/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def create_feature_support
end

def configure_environment
environment(<<~CONFIG, env: %w[development test]) if ::Rails::VERSION::MAJOR >= 6
environment(<<~CONFIG, env: %w[development test])
# Configure 'rails notes' to inspect Cucumber files
config.annotations.register_directories('features')
config.annotations.register_extensions('feature') { |tag| /#\\s*(\#{tag}):?\\s*(.*)$/ }
Expand Down
14 changes: 6 additions & 8 deletions spec/generators/cucumber/install_generator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,12 @@ def create_config_files_the_generator_is_expected_to_modify
it { is_expected.to contain 'load Cucumber::BINARY' }
end

if Rails::VERSION::MAJOR >= 6
%w[development test].each do |environment|
describe "config/environments/#{environment}.rb" do
subject { file("config/environments/#{environment}.rb") }

it { is_expected.to contain "config.annotations.register_extensions('feature') { |tag| /#\\s*(\#{tag}):?\\s*(.*)$/ }" }
it { is_expected.to contain "config.annotations.register_directories('features')" }
end
%w[development test].each do |environment|
describe "config/environments/#{environment}.rb" do
subject { file("config/environments/#{environment}.rb") }

it { is_expected.to contain "config.annotations.register_extensions('feature') { |tag| /#\\s*(\#{tag}):?\\s*(.*)$/ }" }
it { is_expected.to contain "config.annotations.register_directories('features')" }
end
end
end
Expand Down