Skip to content

Commit

Permalink
Merge pull request #1498 from fatkodima/rails-8.0
Browse files Browse the repository at this point in the history
Test against rails 8.0
  • Loading branch information
fatkodima authored Oct 23, 2024
2 parents 82b73c9 + 5d7ddb4 commit 491569c
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 5 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,15 @@ jobs:
# have set this up with each database as a separate job, but then we'd be
# duplicating the matrix configuration three times.
matrix:
gemfile: [ 'rails_6.1', 'rails_7.0', 'rails_7.1', 'rails_7.2' ]
gemfile: [ 'rails_6.1', 'rails_7.0', 'rails_7.1', 'rails_7.2', 'rails_8.0' ]

# To keep matrix size down, only test highest and lowest rubies.
# See "Lowest supported ruby version" in CONTRIBUTING.md
ruby: [ '3.1', '3.3' ]
exclude:
# Rails 8 requires ruby 3.2+.
- gemfile: 'rails_8.0'
ruby: '3.1'
steps:
- name: Checkout source
uses: actions/checkout@v4
Expand Down
6 changes: 6 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,9 @@ appraise "rails-7.2" do
gem "rails", "~> 7.2.0"
gem "rails-controller-testing", "~> 1.0.5"
end

appraise "rails-8.0" do
gem "rails", "~> 8.0.0.rc1"
gem "rails-controller-testing", "~> 1.0.5"
gem "sqlite3", ">= 2.1"
end
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ recommendations of [keepachangelog.com](http://keepachangelog.com/).

### Added

- [#1498](https://github.com/paper-trail-gem/paper_trail/pull/1498) -
Rails 8.0
- [#1422](https://github.com/paper-trail-gem/paper_trail/pull/1450) - Add `version_error_behavior` config
config option to control error handling when creating/updating/deleting `Version` records.

Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ Choose version:

| paper_trail | ruby | activerecord |
|-------------|----------|---------------|
| unreleased | >= 3.1.0 | >= 6.1, <= 7.2 |
| unreleased | >= 3.1.0 | >= 6.1, <= 8.0 |
| 15.2 | >= 3.1.0 | >= 6.1, <= 7.2 |
| 15.1 | >= 3.1.0 | >= 6.1, <= 7.1 |
| 15 | >= 3.0.0 | >= 6.1, < 7.2 |
| 14 | >= 2.7.0 | >= 6.0, < 7.1 |
| 13 | >= 2.6.0 | >= 5.2, < 7.1 |
Expand Down
9 changes: 9 additions & 0 deletions gemfiles/rails_8.0.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "rails", "~> 8.0.0.rc1"
gem "rails-controller-testing", "~> 1.0.5"
gem "sqlite3", ">= 2.1"

gemspec path: "../"
2 changes: 1 addition & 1 deletion lib/paper_trail/compatibility.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module PaperTrail
# versions.
module Compatibility
ACTIVERECORD_GTE = ">= 6.1" # enforced in gemspec
ACTIVERECORD_LT = "< 7.3" # not enforced in gemspec
ACTIVERECORD_LT = "< 8.1" # not enforced in gemspec

E_INCOMPATIBLE_AR = <<-EOS
PaperTrail %s is not compatible with ActiveRecord %s. We allow PT
Expand Down
6 changes: 5 additions & 1 deletion spec/dummy_app/app/models/post_with_status.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,9 @@
class PostWithStatus < ApplicationRecord
has_paper_trail

enum status: { draft: 0, published: 1, archived: 2 }
if ActiveRecord::VERSION::MAJOR >= 7
enum :status, { draft: 0, published: 1, archived: 2 }
else
enum status: { draft: 0, published: 1, archived: 2 }
end
end
2 changes: 1 addition & 1 deletion spec/paper_trail/compatibility_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module PaperTrail

context "when incompatible" do
it "writes a warning to stderr" do
ar_version = ::Gem::Version.new("8.0.0")
ar_version = ::Gem::Version.new("8.1.0")
expect {
described_class.check_activerecord(ar_version)
}.to output(/not compatible/).to_stderr
Expand Down

0 comments on commit 491569c

Please sign in to comment.