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

Support rails 7.1 #575

Merged
merged 4 commits into from
Oct 12, 2023
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: 3 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
fail-fast: false
matrix:
ruby: ['2.6', '2.7', '3.0', '3.1', '3.2']
gemfile: ['rails_5_2', 'rails_6_0', 'rails_6_1', 'rails_7_0']
gemfile: ['rails_5_2', 'rails_6_0', 'rails_6_1', 'rails_7_0', 'rails_7_1']
exclude:
# Latest ruby will test
# - all rails versions in current major
Expand All @@ -34,7 +34,9 @@ jobs:
- { ruby: '2.6', gemfile: 'rails_6_0' }
- { ruby: '2.6', gemfile: 'rails_6_1' }
- { ruby: '2.6', gemfile: 'rails_7_0' }
- { ruby: '2.6', gemfile: 'rails_7_1' }
- { ruby: '2.7', gemfile: 'rails_7_0' }
- { 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' }
- { ruby: '3.1', gemfile: 'rails_5_2' }
Expand Down
6 changes: 6 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,9 @@ appraise 'rails_7_0' do
gem 'railties', '~> 7.0.0'
gem 'sqlite3', '~> 1.4'
end

appraise 'rails_7_1' do
gem 'activerecord'
gem 'railties', '~> 7.1.0'
gem 'sqlite3', '~> 1.4'
end
5 changes: 5 additions & 0 deletions features/emulate_javascript.feature
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ Feature: Emulate Javascript
before_action except: :establish do
render text: 'denied', status: :forbidden and return false unless session[:verified]
end

# Rails 7.1 introduces raise_on_missing_callback_conditionals and it's on by default
def establish
raise "This action must be implemented in child controllers"
end
end
"""
And I write to "features/widgets.feature" with:
Expand Down
9 changes: 9 additions & 0 deletions gemfiles/rails_7_1.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", "~> 7.1.0"
gem "sqlite3", "~> 1.4"

gemspec path: "../"
9 changes: 8 additions & 1 deletion lib/cucumber/rails/action_dispatch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@ module ActionDispatch
module ShowExceptions
def call(env)
env['action_dispatch.show_detailed_exceptions'] = !ActionController::Base.allow_rescue
env['action_dispatch.show_exceptions'] = !env['action_dispatch.show_detailed_exceptions']

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
show_exceptions = show_exceptions ? :all : :none
end

env['action_dispatch.show_exceptions'] = show_exceptions
super(env)
end
end
Expand Down