Skip to content

Commit

Permalink
Added Active Record 7.2 to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed May 30, 2024
1 parent a0c3cc3 commit b24dabf
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
matrix:
include:
- ruby: 3.3
gemfile: Gemfile
gemfile: gemfiles/activerecord72.gemfile
- ruby: 3.2
gemfile: Gemfile
- ruby: 3.1
Expand Down
9 changes: 9 additions & 0 deletions gemfiles/activerecord72.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
source "https://rubygems.org"

gemspec path: ".."

gem "rake"
gem "minitest", ">= 5"
gem "activerecord", "~> 7.2.0.alpha", github: "rails/rails", branch: "7-2-stable"
gem "pg"
gem "mysql2"
2 changes: 1 addition & 1 deletion test/alphabetize_schema_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def dump_schema
require "stringio"

io = StringIO.new
ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection, io)
ActiveRecord::SchemaDumper.dump(connection_class, io)
io.string
end
end
12 changes: 10 additions & 2 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,20 @@ def migration_version

def schema_migration
if ActiveRecord::VERSION::STRING.to_f >= 7.1
ActiveRecord::Base.connection.schema_migration
connection_class.schema_migration
else
ActiveRecord::SchemaMigration
end
end

def connection_class
if ActiveRecord::VERSION::STRING.to_f >= 7.2
ActiveRecord::Base.connection_pool
else
ActiveRecord::Base.connection
end
end

schema_migration.create_table

ActiveRecord::Schema.define do
Expand Down Expand Up @@ -125,7 +133,7 @@ def migrate(migration, direction: :up, version: 123)
end
args =
if ActiveRecord::VERSION::STRING.to_f >= 7.1
[schema_migration, ActiveRecord::Base.connection.internal_metadata]
[schema_migration, connection_class.internal_metadata]
elsif ActiveRecord::VERSION::MAJOR >= 6
[schema_migration]
else
Expand Down

0 comments on commit b24dabf

Please sign in to comment.