Ensure compatibility with Ruby 3.1

This commit is contained in:
Sebastian Serth
2022-06-30 16:32:09 +02:00
parent 0ab3d0bdc1
commit 55937d3cc5
2 changed files with 13 additions and 4 deletions

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
class ServiceBase
def self.call(*args)
new(*args).execute
def self.call(**args)
new(**args).execute
end
end

View File

@ -1,14 +1,23 @@
# frozen_string_literal: true
require 'find'
require 'yaml'
require 'active_support'
require 'rails'
describe 'yaml config files' do
Find.find(__dir__, 'config') do |path|
next unless /.*.\.yml/.match?(path)
before do
allow(Rails).to receive(:root).and_return(Pathname.new('/tmp'))
app = instance_double Rails::Application
allow(Rails).to receive(:application).and_return app
allow(app).to receive(:credentials).and_return({})
end
it "loads #{path} without syntax error" do
expect { YAML.load_file(path) }.not_to raise_error
expect { ActiveSupport::ConfigurationFile.parse(path) }.not_to raise_error
end
end
end