Skip to content

Commit

Permalink
fix: Rails 7.0 support
Browse files Browse the repository at this point in the history
  • Loading branch information
palkan committed Dec 1, 2023
1 parent c289bf1 commit 2bfef20
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/rspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ jobs:
- ruby: "3.2"
gemfile: "gemfiles/rails7.gemfile"
db: "postgres"
- ruby: "3.2"
gemfile: "gemfiles/rails70.gemfile"
db: "postgres"
- ruby: "3.2"
gemfile: "gemfiles/rails7.gemfile"
db: "mysql"
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## master

- Fix Rails 7.0 support. ([@palkan][])

## 1.0.0 (2023-11-30)

- Add ability to track concurrent transactions to with a thread (e.g., to multiple databases). ([@palkan][])
Expand Down
8 changes: 8 additions & 0 deletions gemfiles/rails70.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
source "https://rubygems.org"

gem "rails", "~> 7.0.0"
gem "sqlite3"
gem "pg"
gem "mysql2"

gemspec path: ".."
4 changes: 2 additions & 2 deletions lib/isolator/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ def teardown_fixtures(*)
::ActiveRecord::TestFixtures.prepend(TestFixtures)
end

# Rails 6 doesn't support this load hook, so we can emulate it
if ActiveRecord::VERSION::MAJOR < 7 && defined?(::ActiveRecord::TestFixtures)
# Rails <7.1 doesn't support this load hook, so we we fallback to the prev behaviour
if (ActiveRecord::VERSION::MAJOR < 7 || ActiveRecord::VERSION::MINOR < 1) && defined?
::ActiveRecord::TestFixtures.prepend(TestFixtures)
end
end
Expand Down

0 comments on commit 2bfef20

Please sign in to comment.