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

Test against rails 7.1 #995

Merged
merged 1 commit into from
Dec 15, 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
1 change: 1 addition & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
- "6.0"
- "6.1"
- "7.0"
- "7.1"
ruby:
- "2.7.6"
- "3.0.4"
Expand Down
10 changes: 7 additions & 3 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
appraise "rails_6.0" do
gem "railties", "~> 6.0"
gem "railties", "~> 6.0.0"
gem "net-smtp", require: false # not bundled in ruby 3.1
gem "psych", "< 4" # psych 4 switched from unsafe load to safe load
end

appraise "rails_6.1" do
gem "railties", "~> 6.1"
gem "railties", "~> 6.1.0"
gem "net-smtp", require: false # not bundled in ruby 3.1
end

appraise "rails_7.0" do
gem "railties", "~> 7.0"
gem "railties", "~> 7.0.0"
end

appraise "rails_7.1" do
gem "railties", "~> 7.1.0"
end
2 changes: 1 addition & 1 deletion gemfiles/rails_6.0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ gem "rspec-rails"
gem "shoulda-matchers"
gem "sqlite3"
gem "timecop"
gem "railties", "~> 6.0"
gem "railties", "~> 6.0.0"
gem "net-smtp", require: false
gem "psych", "< 4"

Expand Down
2 changes: 1 addition & 1 deletion gemfiles/rails_6.1.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ gem "rspec-rails"
gem "shoulda-matchers"
gem "sqlite3"
gem "timecop"
gem "railties", "~> 6.1"
gem "railties", "~> 6.1.0"
gem "net-smtp", require: false

gemspec path: "../"
2 changes: 1 addition & 1 deletion gemfiles/rails_7.0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ gem "rspec-rails"
gem "shoulda-matchers"
gem "sqlite3"
gem "timecop"
gem "railties", "~> 7.0"
gem "railties", "~> 7.0.0"

gemspec path: "../"
21 changes: 21 additions & 0 deletions gemfiles/rails_7.1.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "addressable"
gem "ammeter"
gem "appraisal"
gem "capybara"
gem "database_cleaner"
gem "erb_lint", require: false
gem "factory_bot_rails"
gem "nokogiri"
gem "pry", require: false
gem "rails-controller-testing"
gem "rspec-rails"
gem "shoulda-matchers"
gem "sqlite3"
gem "timecop"
gem "railties", "~> 7.1.0"

gemspec path: "../"
7 changes: 6 additions & 1 deletion lib/clearance/authentication.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,12 @@ def sign_in(user, &block)
clearance_session.sign_in(user, &block)

if signed_in? && Clearance.configuration.rotate_csrf_on_sign_in?
session.delete(:_csrf_token)
if request.respond_to?(:reset_csrf_token)
# Rails 7.1+
request.reset_csrf_token
else
request.session.try(:delete, :_csrf_token)
end
form_authenticity_token
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/clearance/testing/deny_access_matcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def redirects_to_url?
@failure_message_when_negated <<
"Didn't expect to redirect to #{@url}."
true
rescue Minitest::Assertion, ::Test::Unit::AssertionFailedError
rescue ::Minitest::Assertion, ::Test::Unit::AssertionFailedError
@failure_message << "Expected to redirect to #{@url} but did not."
false
end
Expand Down
Loading