Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Rails 8 compatibility #590

Merged
merged 1 commit into from
Nov 21, 2024
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
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,18 @@ jobs:
- { ruby: '3.0', gemfile: 'rails_7_0' }
# 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.3', gemfile: 'rails_7_0' }
- { ruby: '3.3', gemfile: 'rails_7_1' }
- { ruby: '3.3', gemfile: 'rails_7_2' }
- { ruby: '3.3', gemfile: 'rails_8_0' }
# Supported rubies will test all permissible supported rails versions
ruby: ['3.1', '3.2']
gemfile: ['rails_5_2', 'rails_6_0', 'rails_6_1', 'rails_7_0', 'rails_7_1', 'rails_7_2']
gemfile: ['rails_5_2', 'rails_6_0', 'rails_6_1', 'rails_7_0', 'rails_7_1', 'rails_7_2', 'rails_8_0']
exclude:
# Ruby 3.0+ doesn't work with Rails 5.2: https://github.com/rails/rails/issues/40938
# 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_5_2' }
- { ruby: '3.1', gemfile: 'rails_6_0' }
- { ruby: '3.1', gemfile: 'rails_6_1' }
- { ruby: '3.1', gemfile: 'rails_8_0' }
- { ruby: '3.2', gemfile: 'rails_5_2' }
- { ruby: '3.2', gemfile: 'rails_6_0' }
- { ruby: '3.2', gemfile: 'rails_6_1' }
Expand Down
6 changes: 6 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,9 @@ appraise 'rails_7_2' do
gem 'railties', '~> 7.2.2'
gem 'sqlite3', '~> 2.2'
end

appraise 'rails_8_0' do
gem 'activerecord'
gem 'railties', '~> 8.0.0'
gem 'sqlite3', '~> 2.2'
end
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ This file is intended to be modified using the [`changelog`](https://github.com/

## [Unreleased]

- Add support for Rails 8.0 (No code changes required) [#590](https://github.com/cucumber/cucumber-rails/pull/590)

## [3.0.1] - 2024-11-05
### Changed
- Add support for Rails 7.2 / Ruby 3.3 (No code changes required) [#586](https://github.com/cucumber/cucumber-rails/pull/586) [#588](https://github.com/cucumber/cucumber-rails/pull/588)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[![Code Climate](https://codeclimate.com/github/cucumber/cucumber-rails.svg)](https://codeclimate.com/github/cucumber/cucumber-rails)
[![Open Source Helpers](https://www.codetriage.com/cucumber/cucumber-rails/badges/users.svg)](https://www.codetriage.com/cucumber/cucumber-rails)

Cucumber-Rails brings Cucumber to Rails 5.2, 6.x and 7.x.
Cucumber-Rails brings Cucumber to Rails 5.2, 6.x, 7.x, and 8.0.
luke-hill marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Contributor Author

@tagliala tagliala Nov 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the constraint is < 9, 8.0 may not play well with the gemspec but reflects actual compatibility

8.0 should be changed to 8.x after it is certain that cucumber-rails will also support 8.1


## Installation

Expand Down
4 changes: 2 additions & 2 deletions cucumber-rails.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ Gem::Specification.new do |s|

s.add_runtime_dependency('capybara', '>= 3.11', '< 4')
s.add_runtime_dependency('cucumber', '>= 5', '< 10')
s.add_runtime_dependency('railties', '>= 5.2', '< 8')
tagliala marked this conversation as resolved.
Show resolved Hide resolved
s.add_runtime_dependency('railties', '>= 5.2', '< 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('database_cleaner', '>= 1.8', '< 3.0')
s.add_development_dependency('rails', '>= 5.2', '< 8')
s.add_development_dependency('rails', '>= 5.2', '< 9')
s.add_development_dependency('rake', '>= 13.0')
s.add_development_dependency('rspec', '~> 3.12')
s.add_development_dependency('rubocop', '~> 1.45.0')
Expand Down
2 changes: 1 addition & 1 deletion features/allow_rescue.feature
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Feature: Allow Cucumber to rescue exceptions
end

Then('I should see the public error page') do
expect(page).to have_content "We're sorry, but something went wrong."
luke-hill marked this conversation as resolved.
Show resolved Hide resolved
expect(page).to have_content "sorry, but something went wrong."
end
"""
And I run `bundle exec rake db:migrate`
Expand Down
19 changes: 15 additions & 4 deletions features/support/cucumber_rails_gem_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ module CucumberRailsGemHelper
def install_cucumber_rails(*options)
configure_rails_gems
add_cucumber_rails(options)
add_rails_conditional_gems
add_sqlite3_gem
add_selenium_webdriver_gem
add_remaining_gems(options)
bundle_install
run_command_and_stop 'bundle exec rails generate cucumber:install'
Expand All @@ -29,13 +30,23 @@ def add_cucumber_rails(options)
end
end

def add_rails_conditional_gems
if rails_equal_or_higher_than?('6.0')
def add_sqlite3_gem
luke-hill marked this conversation as resolved.
Show resolved Hide resolved
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'
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')
add_gem 'selenium-webdriver', '~> 4.0', group: :test
add_gem 'webdrivers', '~> 5.0', group: :test
else
add_gem 'sqlite3', '~> 1.3.13'
add_gem 'selenium-webdriver', '< 4', group: :test
add_gem 'webdrivers', '~> 4.0', group: :test
remove_gem 'chromedriver-helper'
Expand Down
9 changes: 9 additions & 0 deletions gemfiles/rails_8_0.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "activerecord"
gem "railties", "~> 8.0.0"
gem "sqlite3", "~> 2.2"

gemspec path: "../"