Skip to content

Commit

Permalink
Support ruby 3.1 by using a compatible way to YAML.load with aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
jrafanie committed Jan 18, 2024
1 parent e0a10cc commit e643c4d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
ruby-version:
- '2.7'
- '3.0'
- '3.1'
rails-version:
- '6.0'
- '6.1'
Expand Down
8 changes: 7 additions & 1 deletion spec/config_handler/rails_config_handler_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

before do
@yml_file = Tempfile.new('database.yml')
yml_data = YAML.load(<<-DOC)
data = <<-DOC
---
base: &base
username: user
Expand All @@ -16,6 +16,12 @@
pool: 3
database: vmdb_test
DOC
yml_data =
if YAML.respond_to?(:safe_load)
YAML.safe_load(data, :aliases => true)
else
YAML.load(data)
end
File.write(@yml_file.path, yml_data.to_yaml)
end

Expand Down

0 comments on commit e643c4d

Please sign in to comment.