Skip to content

Commit

Permalink
Fix YAML load for ruby 3.1.
Browse files Browse the repository at this point in the history
See ruby/psych#487 for more information.
  • Loading branch information
wpolicarpo authored and Lavika committed Sep 26, 2023
1 parent 108af2c commit 40217f2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion test/cases/coerced_tests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1486,7 +1486,8 @@ class YamlSerializationTest < ActiveRecord::TestCase
coerce_tests! :test_types_of_virtual_columns_are_not_changed_on_round_trip
def test_types_of_virtual_columns_are_not_changed_on_round_trip_coerced
author = Author.select("authors.*, 5 as posts_count").first
dumped = YAML.load(YAML.dump(author))
dumped_author = YAML.dump(author)
dumped = YAML.respond_to?(:unsafe_load) ? YAML.unsafe_load(dumped_author) : YAML.load(dumped_author)
assert_equal 5, author.posts_count
assert_equal 5, dumped.posts_count
end
Expand Down
3 changes: 2 additions & 1 deletion test/cases/rake_test_sqlserver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ class SQLServerRakeSchemaCacheDumpLoadTest < SQLServerRakeTest
it "dumps schema cache with SQL Server metadata" do
quietly { db_tasks.dump_schema_cache connection, filename }

schema_cache = YAML.load(File.read(filename))
filedata = File.read(filename)
schema_cache = YAML.respond_to?(:unsafe_load) ? YAML.unsafe_load(filedata) : YAML.load(filedata)

col_id, col_name = connection.schema_cache.columns("users")

Expand Down

0 comments on commit 40217f2

Please sign in to comment.