From d9a91bc61be54177f91a04f582a72ab793c04db6 Mon Sep 17 00:00:00 2001 From: hatsu Date: Fri, 3 Nov 2023 03:48:42 +0900 Subject: [PATCH] Support for writing style deprecated in 7.1 and removed in 7.2 (#1606) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Support for writing style deprecated in 7.1 and removed in 7.2 * test: 💍 MiniTest->Minitest * 7.1 -> 7.2 --- .../devise_token_auth/concerns/active_record_support.rb | 6 +++++- devise_token_auth.gemspec | 2 +- .../devise_token_auth/sessions_controller_test.rb | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/models/devise_token_auth/concerns/active_record_support.rb b/app/models/devise_token_auth/concerns/active_record_support.rb index e86d2c17f..69d203205 100644 --- a/app/models/devise_token_auth/concerns/active_record_support.rb +++ b/app/models/devise_token_auth/concerns/active_record_support.rb @@ -2,7 +2,11 @@ module DeviseTokenAuth::Concerns::ActiveRecordSupport extend ActiveSupport::Concern included do - serialize :tokens, DeviseTokenAuth::Concerns::TokensSerialization + if Rails::VERSION::MAJOR >= 7 && Rails::VERSION::MINOR >= 1 + serialize :tokens, coder: DeviseTokenAuth::Concerns::TokensSerialization + else + serialize :tokens, DeviseTokenAuth::Concerns::TokensSerialization + end end class_methods do diff --git a/devise_token_auth.gemspec b/devise_token_auth.gemspec index 1a3931de7..ea1e24b0d 100644 --- a/devise_token_auth.gemspec +++ b/devise_token_auth.gemspec @@ -22,7 +22,7 @@ Gem::Specification.new do |s| s.required_ruby_version = ">= 2.3.0" - s.add_dependency 'rails', '>= 4.2.0', '< 7.1' + s.add_dependency 'rails', '>= 4.2.0', '< 7.2' s.add_dependency 'devise', '> 3.5.2', '< 5' s.add_dependency 'bcrypt', '~> 3.0' diff --git a/test/controllers/devise_token_auth/sessions_controller_test.rb b/test/controllers/devise_token_auth/sessions_controller_test.rb index 7df323707..343cdba7f 100644 --- a/test/controllers/devise_token_auth/sessions_controller_test.rb +++ b/test/controllers/devise_token_auth/sessions_controller_test.rb @@ -420,7 +420,7 @@ def @controller.reset_session describe 'With paranoid mode' do before do mock_hash = '$2a$04$MUWADkfA6MHXDdWHoep6QOvX1o0Y56pNqt3NMWQ9zCRwKSp1HZJba' - @bcrypt_mock = MiniTest::Mock.new + @bcrypt_mock = Minitest::Mock.new @bcrypt_mock.expect(:call, mock_hash, [Object, String]) swap Devise, paranoid: true do