From 55937d3cc527ce8700d4c95556a2a28a92cbd17a Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Thu, 30 Jun 2022 16:32:09 +0200 Subject: [PATCH] Ensure compatibility with Ruby 3.1 --- app/services/service_base.rb | 4 ++-- spec/helpers/yaml_spec.rb | 13 +++++++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/app/services/service_base.rb b/app/services/service_base.rb index 39010bb7..902944f3 100644 --- a/app/services/service_base.rb +++ b/app/services/service_base.rb @@ -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 diff --git a/spec/helpers/yaml_spec.rb b/spec/helpers/yaml_spec.rb index 6222f3a9..1abd544e 100644 --- a/spec/helpers/yaml_spec.rb +++ b/spec/helpers/yaml_spec.rb @@ -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