From 31f32cc6ba1003d586f07124a91612946fc8d8d3 Mon Sep 17 00:00:00 2001 From: Scott Barr Date: Tue, 19 May 2026 23:17:06 -0400 Subject: [PATCH 1/4] fix: resolve CI failures from dropped MiniTest constant and removed Rails deprecation API - Remove dead Rails 4.0.x shim that checked `MiniTest::Test`; modern minitest (5+) dropped the MiniTest constant in favour of Minitest, causing a NameError that prevented any test from loading - Guard `ActiveSupport::Deprecation` calls with respond_to? since Rails 7.1+ removed .behavior= and .silenced= from the singleton - Update actions/checkout from v4.3.1 to v6.0.2 and ruby/setup-ruby from v1.306.0 to v1.308.0 ahead of the June 2 2026 forced migration from Node.js 20 to 24 on GitHub Actions runners --- .github/workflows/default.yml | 4 ++-- test/legacy_active_record_test.rb | 4 ++-- test/test_helper.rb | 7 +------ 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/.github/workflows/default.yml b/.github/workflows/default.yml index 22248c0..a9c49af 100644 --- a/.github/workflows/default.yml +++ b/.github/workflows/default.yml @@ -21,11 +21,11 @@ jobs: - 7.0 steps: # Need to fetch all refs, so we can check if the version has been bumped - - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: fetch-depth: 0 - - uses: ruby/setup-ruby@v1 + - uses: ruby/setup-ruby@97ecb7b512899eb71ab1bf2310a624c6f1589ac6 # v1.308.0 with: bundler-cache: true env: diff --git a/test/legacy_active_record_test.rb b/test/legacy_active_record_test.rb index 8023185..8c1f3da 100644 --- a/test/legacy_active_record_test.rb +++ b/test/legacy_active_record_test.rb @@ -29,9 +29,9 @@ class LegacyPerson < ActiveRecord::Base attr_encrypted :email, :key => 'a secret key' attr_encrypted :credentials, :key => Proc.new { |user| Encryptor.encrypt(:value => user.salt, :key => 'some private key', insecure_mode: true, algorithm: 'aes-256-cbc') }, :marshal => true - ActiveSupport::Deprecation.silenced = true + ActiveSupport::Deprecation.silenced = true if defined?(ActiveSupport::Deprecation) && ActiveSupport::Deprecation.respond_to?(:silenced=) def after_initialize; end - ActiveSupport::Deprecation.silenced = false + ActiveSupport::Deprecation.silenced = false if defined?(ActiveSupport::Deprecation) && ActiveSupport::Deprecation.respond_to?(:silenced=) after_initialize :initialize_salt_and_credentials diff --git a/test/test_helper.rb b/test/test_helper.rb index f82e632..e5b0f9e 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -2,15 +2,10 @@ require 'minitest/autorun' -# Rails 4.0.x pins to an old minitest -unless defined?(MiniTest::Test) - MiniTest::Test = MiniTest::Unit::TestCase -end - require 'active_record' require 'digest/sha2' require 'sequel' -ActiveSupport::Deprecation.behavior = :raise +ActiveSupport::Deprecation.behavior = :raise if defined?(ActiveSupport::Deprecation) && ActiveSupport::Deprecation.respond_to?(:behavior=) $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) $:.unshift(File.dirname(__FILE__)) From d2b02b7849c783f4395fc3662ef78d20092edccb Mon Sep 17 00:00:00 2001 From: Scott Barr Date: Tue, 19 May 2026 23:20:23 -0400 Subject: [PATCH 2/4] chore: bump Ruby to 3.4.9 and fix minitest 6 stub incompatibility minitest 6 (compatible with Ruby 3.4+) removed mock/stub support. Replace the Object#stub call with define_singleton_method, which is equivalent and has no framework dependency. --- .ruby-version | 2 +- test/attr_encrypted_test.rb | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.ruby-version b/.ruby-version index 6ebad14..7bcbb38 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.1.2 \ No newline at end of file +3.4.9 diff --git a/test/attr_encrypted_test.rb b/test/attr_encrypted_test.rb index 0df966a..2903b73 100644 --- a/test/attr_encrypted_test.rb +++ b/test/attr_encrypted_test.rb @@ -482,9 +482,8 @@ def test_encrypted_attributes_state_is_not_shared def test_should_not_by_default_generate_key_when_attribute_is_empty user = User.new calls = 0 - user.stub(:secret_key, lambda { calls += 1; SECRET_KEY }) do - user.ssn - end + user.define_singleton_method(:secret_key) { calls += 1; SECRET_KEY } + user.ssn assert_equal 0, calls end end From b95aeb49f22a1b905f01e8724f8a48530760e500 Mon Sep 17 00:00:00 2001 From: Scott Barr Date: Tue, 19 May 2026 23:24:39 -0400 Subject: [PATCH 3/4] chore: update CI matrix from AR 6.1/7.0 to AR 7.2/8.1 Both versions verified locally: 147 runs, 0 failures, 0 errors for each. --- .github/workflows/default.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/default.yml b/.github/workflows/default.yml index a9c49af..5aa834a 100644 --- a/.github/workflows/default.yml +++ b/.github/workflows/default.yml @@ -13,12 +13,12 @@ jobs: preflight_check: name: Preflight Check runs-on: ubuntu-latest - # do a matrix for ACTIVERECORD_VERSION of 6.1 and 7.0 + # do a matrix for ACTIVERECORD_VERSION of 7.2 and 8.1 strategy: matrix: activerecord_version: - - 6.1 - - 7.0 + - 7.2 + - 8.1 steps: # Need to fetch all refs, so we can check if the version has been bumped - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 From c387e61d118020ede46a83b57aaf02d659fb1ec5 Mon Sep 17 00:00:00 2001 From: Scott Barr Date: Tue, 19 May 2026 23:29:18 -0400 Subject: [PATCH 4/4] chore: bump version to 3.2.0 ActiveRecord 6.x is no longer included in the test matrix. --- CHANGELOG.md | 7 +++++++ lib/attr_encrypted/version.rb | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 52ef721..f08eb31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # attr_encrypted # +## 3.2.0 ## +* Changed: Ruby minimum version raised to 3.4.x. +* Changed: CI test matrix updated to ActiveRecord 7.2 and 8.1. ActiveRecord 6.x is no longer included in the test matrix and is not actively supported. +* Fixed: Removed Rails 4.0.x minitest compatibility shim that caused a `NameError` on modern minitest. +* Fixed: Guarded `ActiveSupport::Deprecation` calls that were removed in Rails 7.1+. +* Fixed: Replaced `stub` usage in tests with `define_singleton_method` for minitest 6 compatibility. + ## 3.1.0 ## * Added: Abitilty to encrypt empty values. (@tamird) * Added: MIT license diff --git a/lib/attr_encrypted/version.rb b/lib/attr_encrypted/version.rb index 723ebe9..d2502d7 100644 --- a/lib/attr_encrypted/version.rb +++ b/lib/attr_encrypted/version.rb @@ -4,7 +4,7 @@ module AttrEncrypted # Contains information about this gem's version module Version MAJOR = 3 - MINOR = 1 + MINOR = 2 PATCH = 0 # Returns a version string by joining MAJOR, MINOR, and PATCH with '.'