Skip to content

Commit 499545f

Browse files
committed
Add Rails 8 compatibility
- Conditionally load the sqlite3 gem based on the Rails version. - Simplify error page assertions to account for variations in apostrophes, as "We're sorry" changed to "We`re sorry" in Rails 8. Close #589
1 parent 11897e8 commit 499545f

8 files changed

+35
-7
lines changed

.github/workflows/test.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,17 @@ jobs:
3939
- { ruby: '3.3', gemfile: 'rails_7_0' }
4040
- { ruby: '3.3', gemfile: 'rails_7_1' }
4141
- { ruby: '3.3', gemfile: 'rails_7_2' }
42+
- { ruby: '3.3', gemfile: 'rails_8_0' }
4243
# Supported rubies will test all permissible supported rails versions
4344
ruby: ['3.1', '3.2']
44-
gemfile: ['rails_5_2', 'rails_6_0', 'rails_6_1', 'rails_7_0', 'rails_7_1', 'rails_7_2']
45+
gemfile: ['rails_5_2', 'rails_6_0', 'rails_6_1', 'rails_7_0', 'rails_7_1', 'rails_7_2', 'rails_8_0']
4546
exclude:
4647
# Ruby 3.0+ doesn't work with Rails 5.2: https://github.com/rails/rails/issues/40938
4748
# 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
4849
- { ruby: '3.1', gemfile: 'rails_5_2' }
4950
- { ruby: '3.1', gemfile: 'rails_6_0' }
5051
- { ruby: '3.1', gemfile: 'rails_6_1' }
52+
- { ruby: '3.1', gemfile: 'rails_8_0' }
5153
- { ruby: '3.2', gemfile: 'rails_5_2' }
5254
- { ruby: '3.2', gemfile: 'rails_6_0' }
5355
- { ruby: '3.2', gemfile: 'rails_6_1' }

Appraisals

+6
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,9 @@ appraise 'rails_7_2' do
5151
gem 'railties', '~> 7.2.2'
5252
gem 'sqlite3', '~> 2.2'
5353
end
54+
55+
appraise 'rails_8_0' do
56+
gem 'activerecord'
57+
gem 'railties', '~> 8.0.0'
58+
gem 'sqlite3', '~> 2.2'
59+
end

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ This file is intended to be modified using the [`changelog`](https://github.com/
99

1010
## [Unreleased]
1111

12+
- Add support for Rails 8.0 (No code changes required) [#590](https://github.com/cucumber/cucumber-rails/pull/590)
13+
1214
## [3.0.1] - 2024-11-05
1315
### Changed
1416
- 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)

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[![Code Climate](https://codeclimate.com/github/cucumber/cucumber-rails.svg)](https://codeclimate.com/github/cucumber/cucumber-rails)
66
[![Open Source Helpers](https://www.codetriage.com/cucumber/cucumber-rails/badges/users.svg)](https://www.codetriage.com/cucumber/cucumber-rails)
77

8-
Cucumber-Rails brings Cucumber to Rails 5.2, 6.x and 7.x.
8+
Cucumber-Rails brings Cucumber to Rails 5.2, 6.x, 7.x, and 8.0.
99

1010
## Installation
1111

cucumber-rails.gemspec

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ Gem::Specification.new do |s|
2626

2727
s.add_runtime_dependency('capybara', '>= 3.11', '< 4')
2828
s.add_runtime_dependency('cucumber', '>= 5', '< 10')
29-
s.add_runtime_dependency('railties', '>= 5.2', '< 8')
29+
s.add_runtime_dependency('railties', '>= 5.2', '< 8.1')
3030

3131
# Main development dependencies
3232
s.add_development_dependency('ammeter', '>= 1.1.5')
3333
s.add_development_dependency('appraisal', '>= 2.4.1', '< 3')
3434
s.add_development_dependency('aruba', '>= 1.1.2', '< 3')
3535
s.add_development_dependency('database_cleaner', '>= 1.8', '< 3.0')
36-
s.add_development_dependency('rails', '>= 5.2', '< 8')
36+
s.add_development_dependency('rails', '>= 5.2', '< 8.1')
3737
s.add_development_dependency('rake', '>= 13.0')
3838
s.add_development_dependency('rspec', '~> 3.12')
3939
s.add_development_dependency('rubocop', '~> 1.45.0')

features/allow_rescue.feature

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Feature: Allow Cucumber to rescue exceptions
3333
end
3434
3535
Then('I should see the public error page') do
36-
expect(page).to have_content "We're sorry, but something went wrong."
36+
expect(page).to have_content "sorry, but something went wrong."
3737
end
3838
"""
3939
And I run `bundle exec rake db:migrate`

features/support/cucumber_rails_gem_helper.rb

+11-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ module CucumberRailsGemHelper
88
def install_cucumber_rails(*options)
99
configure_rails_gems
1010
add_cucumber_rails(options)
11+
add_sqlite_gem
1112
add_rails_conditional_gems
1213
add_remaining_gems(options)
1314
bundle_install
@@ -29,13 +30,21 @@ def add_cucumber_rails(options)
2930
end
3031
end
3132

33+
def add_sqlite_gem
34+
if rails_equal_or_higher_than?('7.1')
35+
add_gem 'sqlite3', '~> 2.0'
36+
elsif rails_equal_or_higher_than?('6.0')
37+
add_gem 'sqlite3', '~> 1.4'
38+
else
39+
add_gem 'sqlite3', '~> 1.3.13'
40+
end
41+
end
42+
3243
def add_rails_conditional_gems
3344
if rails_equal_or_higher_than?('6.0')
34-
add_gem 'sqlite3', '~> 1.4'
3545
add_gem 'selenium-webdriver', '~> 4.0', group: :test
3646
add_gem 'webdrivers', '~> 5.0', group: :test
3747
else
38-
add_gem 'sqlite3', '~> 1.3.13'
3948
add_gem 'selenium-webdriver', '< 4', group: :test
4049
add_gem 'webdrivers', '~> 4.0', group: :test
4150
remove_gem 'chromedriver-helper'

gemfiles/rails_8_0.gemfile

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# This file was generated by Appraisal
2+
3+
source "https://rubygems.org"
4+
5+
gem "activerecord"
6+
gem "railties", "~> 8.0.0"
7+
gem "sqlite3", "~> 2.2"
8+
9+
gemspec path: "../"

0 commit comments

Comments
 (0)