Skip to content

Commit c7a002c

Browse files
committed
Fix postgres migration issue in spec helper under Rails 7.2
1 parent 83bab73 commit c7a002c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

spec/audited_spec_helpers.rb

+5-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def create_versions(n = 2, attrs = {})
2323
def run_migrations(direction, migrations_paths, target_version = nil)
2424
if rails_below?("5.2.0.rc1")
2525
ActiveRecord::Migrator.send(direction, migrations_paths, target_version)
26-
elsif rails_below?("6.0.0.rc1")
26+
elsif rails_below?("6.0.0.rc1") || rails_at_least?("7.2.0")
2727
ActiveRecord::MigrationContext.new(migrations_paths).send(direction, target_version)
2828
else
2929
ActiveRecord::MigrationContext.new(migrations_paths, ActiveRecord::SchemaMigration).send(direction, target_version)
@@ -33,4 +33,8 @@ def run_migrations(direction, migrations_paths, target_version = nil)
3333
def rails_below?(rails_version)
3434
Gem::Version.new(Rails::VERSION::STRING) < Gem::Version.new(rails_version)
3535
end
36+
37+
def rails_at_least?(rails_version)
38+
Gem::Version.new(Rails::VERSION::STRING) >= Gem::Version.new(rails_version)
39+
end
3640
end

0 commit comments

Comments
 (0)