diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 80380bd7..0f4c5e14 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -19,6 +19,7 @@ jobs: - "6.0" - "6.1" - "7.0" + - "7.1" ruby: - "2.7.6" - "3.0.4" diff --git a/Appraisals b/Appraisals index 69947f18..466faf4f 100644 --- a/Appraisals +++ b/Appraisals @@ -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 diff --git a/gemfiles/rails_6.0.gemfile b/gemfiles/rails_6.0.gemfile index e7b10b92..8896d145 100644 --- a/gemfiles/rails_6.0.gemfile +++ b/gemfiles/rails_6.0.gemfile @@ -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" diff --git a/gemfiles/rails_6.1.gemfile b/gemfiles/rails_6.1.gemfile index c6ddb455..1db7a9f3 100644 --- a/gemfiles/rails_6.1.gemfile +++ b/gemfiles/rails_6.1.gemfile @@ -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: "../" diff --git a/gemfiles/rails_7.0.gemfile b/gemfiles/rails_7.0.gemfile index 0d33ed33..349636f7 100644 --- a/gemfiles/rails_7.0.gemfile +++ b/gemfiles/rails_7.0.gemfile @@ -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: "../" diff --git a/gemfiles/rails_7.1.gemfile b/gemfiles/rails_7.1.gemfile new file mode 100644 index 00000000..8726d560 --- /dev/null +++ b/gemfiles/rails_7.1.gemfile @@ -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: "../" diff --git a/lib/clearance/authentication.rb b/lib/clearance/authentication.rb index a582cd8e..b3c1f2eb 100644 --- a/lib/clearance/authentication.rb +++ b/lib/clearance/authentication.rb @@ -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 diff --git a/lib/clearance/testing/deny_access_matcher.rb b/lib/clearance/testing/deny_access_matcher.rb index 470daa3c..dfa9cc26 100644 --- a/lib/clearance/testing/deny_access_matcher.rb +++ b/lib/clearance/testing/deny_access_matcher.rb @@ -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