Skip to content

Commit 14b6cfd

Browse files
authored
Drop rails 6.1/7.0 and ruby 3.0/3.1 support (#1514)
* Drop rails 6.1/7.0 and ruby 3.0/3.1 support * upgrade rubocop-rspec + rspec-rails * disable RSpec/IndexedLet * autofix RSpec/IndexedLet * auto-fix Style/ArrayIntersect * autofix RSpec/ReceiveMessages * autofix RSpec/MetadataStyle * revert changes from bad rebase * revert .rubocop_todo.yml changes * empty line
1 parent 3cc736e commit 14b6cfd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+169
-192
lines changed

.github/CONTRIBUTING.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ For most development, testing with sqlite only is easiest and sufficient. CI
5454
will run the rest.
5555

5656
```
57-
DB=sqlite bundle exec appraisal rails-6.1 rake
58-
DB=sqlite bundle exec appraisal rails-7.0 rake
59-
DB=mysql bundle exec appraisal rails-7.0 rake
57+
DB=sqlite bundle exec appraisal rails-7.1 rake
58+
DB=sqlite bundle exec appraisal rails-8.0 rake
59+
DB=mysql bundle exec appraisal rails-7.1 rake
6060
createuser --superuser postgres
61-
DB=postgres bundle exec appraisal rails-7.0 rake
61+
DB=postgres bundle exec appraisal rails-7.1 rake
6262
```
6363

6464
## The dummy_app

.github/workflows/test.yml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
uses: ruby/setup-ruby@v1
1818
with:
1919
# See "Lowest supported ruby version" in CONTRIBUTING.md
20-
ruby-version: '3.0'
20+
ruby-version: '3.2'
2121
- name: Bundle
2222
run: |
2323
gem install bundler
@@ -59,18 +59,11 @@ jobs:
5959
# have set this up with each database as a separate job, but then we'd be
6060
# duplicating the matrix configuration three times.
6161
matrix:
62-
gemfile: [ 'rails_6.1', 'rails_7.0', 'rails_7.1', 'rails_7.2', 'rails_8.0' ]
62+
gemfile: [ 'rails_7.1', 'rails_7.2', 'rails_8.0' ]
6363

6464
# To keep matrix size down, only test highest and lowest rubies.
6565
# See "Lowest supported ruby version" in CONTRIBUTING.md
66-
ruby: [ '3.0', '3.3' ]
67-
exclude:
68-
# Rails 8 requires ruby 3.2+.
69-
- gemfile: 'rails_8.0'
70-
ruby: '3.0'
71-
# Rails 7.2 requires ruby 3.1+.
72-
- gemfile: 'rails_7.2'
73-
ruby: '3.0'
66+
ruby: [ '3.2', '3.4' ]
7467
steps:
7568
- name: Checkout source
7669
uses: actions/checkout@v4

.rubocop.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
require:
2-
- rubocop-rspec
3-
41
plugins:
52
- rubocop-packaging
63
- rubocop-performance
74
- rubocop-rails
85
- rubocop-rake
6+
- rubocop-rspec
97

108
inherit_from: .rubocop_todo.yml
119

@@ -25,7 +23,7 @@ AllCops:
2523
NewCops: enable
2624

2725
# See "Lowest supported ruby version" in CONTRIBUTING.md
28-
TargetRubyVersion: 3.0
26+
TargetRubyVersion: 3.2
2927

3028
Gemspec/DevelopmentDependencies:
3129
Enabled: false
@@ -147,6 +145,9 @@ RSpec/DescribeClass:
147145
RSpec/ExampleLength:
148146
Enabled: false
149147

148+
RSpec/IndexedLet:
149+
Enabled: false
150+
150151
# In an ideal world, each example has a single expectation. In the real world,
151152
# sometimes setup is a pain and you don't want to duplicate setup in multiple
152153
# examples, or make the specs more confusing with many nested `context`s, and

Appraisals

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,6 @@
99
# > the version from the appraisal takes precedence.
1010
# > https://github.com/thoughtbot/appraisal
1111

12-
appraise "rails-6.1" do
13-
gem "rails", "~> 6.1.0"
14-
gem "rails-controller-testing", "~> 1.0.5"
15-
end
16-
17-
appraise "rails-7.0" do
18-
gem "rails", "~> 7.0.3.1"
19-
gem "rails-controller-testing", "~> 1.0.5"
20-
end
21-
2212
appraise "rails-7.1" do
2313
gem "rails", "~> 7.1.0"
2414
gem "rails-controller-testing", "~> 1.0.5"

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ recommendations of [keepachangelog.com](http://keepachangelog.com/).
1717

1818
- None
1919

20+
### Dependencies
21+
22+
- Drop support for Rails 6.1, which [reached EoL on 2024-10-01][2]
23+
- Drop support for Rails 7.0, which [reached EoL on 2025-04-01][2]
24+
- Drop support for Ruby 3.0, which [reached EoL on 2024-04-23][3]
25+
- Drop support for Ruby 3.1, which [reached EoL on 2024-03-31][3]
26+
2027
## 16.0.0 (2024-11-08)
2128

2229
### Breaking Changes

lib/paper_trail.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,6 @@ def version
115115
VERSION::STRING
116116
end
117117

118-
def active_record_gte_7_0?
119-
@active_record_gte_7_0 ||= ::ActiveRecord.gem_version >= ::Gem::Version.new("7.0.0")
120-
end
121-
122118
def deprecator
123119
@deprecator ||= ActiveSupport::Deprecation.new("16.0", "PaperTrail")
124120
end

lib/paper_trail/attribute_serializers/cast_attribute_serializer.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def deserialize(attr, val)
3232
if defined_enums[attr] && val.is_a?(::String)
3333
# Because PT 4 used to save the string version of enums to `object_changes`
3434
val
35-
elsif PaperTrail.active_record_gte_7_0? && val.is_a?(ActiveRecord::Type::Time::Value)
35+
elsif val.is_a?(ActiveRecord::Type::Time::Value)
3636
# Because Rails 7 time attribute throws a delegation error when you deserialize
3737
# it with the factory.
3838
# See ActiveRecord::Type::Time::Value crashes when loaded from YAML on rails 7.0

lib/paper_trail/attribute_serializers/object_attribute.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@ def initialize(model_class)
1010
@model_class = model_class
1111

1212
# ActiveRecord since 7.0 has a built-in encryption mechanism
13-
@encrypted_attributes =
14-
if PaperTrail.active_record_gte_7_0?
15-
@model_class.encrypted_attributes&.map(&:to_s)
16-
end
13+
@encrypted_attributes = @model_class.encrypted_attributes&.map(&:to_s)
1714
end
1815

1916
def serialize(attributes)

lib/paper_trail/attribute_serializers/object_changes_attribute.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@ def initialize(item_class)
1010
@item_class = item_class
1111

1212
# ActiveRecord since 7.0 has a built-in encryption mechanism
13-
@encrypted_attributes =
14-
if PaperTrail.active_record_gte_7_0?
15-
@item_class.encrypted_attributes&.map(&:to_s)
16-
end
13+
@encrypted_attributes = @item_class.encrypted_attributes&.map(&:to_s)
1714
end
1815

1916
def serialize(changes)

lib/paper_trail/compatibility.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ module PaperTrail
1717
# newer rails versions. Most PT users should avoid incompatible rails
1818
# versions.
1919
module Compatibility
20-
ACTIVERECORD_GTE = ">= 6.1" # enforced in gemspec
20+
ACTIVERECORD_GTE = ">= 7.1" # enforced in gemspec
2121
ACTIVERECORD_LT = "< 8.1" # not enforced in gemspec
2222

2323
E_INCOMPATIBLE_AR = <<-EOS

0 commit comments

Comments
 (0)