From 79e2e5e6dc1575dd98b4c6b7909d866c36e0c777 Mon Sep 17 00:00:00 2001 From: Joe Rafaniello Date: Mon, 11 Sep 2023 15:29:49 -0400 Subject: [PATCH] psych 4 dropped positional argument support for permitted classes See: https://www.ctrl.blog/entry/ruby-psych4.html --- app/models/dialog_import_validator.rb | 2 +- spec/lib/task_helpers/exports/custom_buttons_spec.rb | 6 +++--- spec/lib/task_helpers/exports/widgets_spec.rb | 4 ++-- spec/models/miq_widget_set_spec.rb | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/models/dialog_import_validator.rb b/app/models/dialog_import_validator.rb index 1507ef52d7f..b089cacdda0 100644 --- a/app/models/dialog_import_validator.rb +++ b/app/models/dialog_import_validator.rb @@ -11,7 +11,7 @@ def initialize(dialog_field_association_validator = DialogFieldAssociationValida end def determine_validity(import_file_upload) - potential_dialogs = YAML.safe_load(import_file_upload.uploaded_content, [Symbol]) + potential_dialogs = YAML.safe_load(import_file_upload.uploaded_content, :permitted_classes => [Symbol]) raise BlankFileError unless potential_dialogs check_dialogs_for_validity(potential_dialogs) diff --git a/spec/lib/task_helpers/exports/custom_buttons_spec.rb b/spec/lib/task_helpers/exports/custom_buttons_spec.rb index 969b86e7f7f..453ed3cedb1 100644 --- a/spec/lib/task_helpers/exports/custom_buttons_spec.rb +++ b/spec/lib/task_helpers/exports/custom_buttons_spec.rb @@ -70,7 +70,7 @@ TaskHelpers::Exports::CustomButtons.new.export(:directory => export_dir) file_contents = File.read("#{export_dir}/CustomButtons.yaml") - expect(YAML.safe_load(file_contents, [Symbol])).to contain_exactly(*custom_button_export_test) + expect(YAML.safe_load(file_contents, :permitted_classes => [Symbol])).to contain_exactly(*custom_button_export_test) expect(Dir[File.join(export_dir, '**', '*')].count { |file| File.file?(file) }).to eq(1) end end @@ -164,7 +164,7 @@ TaskHelpers::Exports::CustomButtons.new.export(:directory => export_dir) file_contents = File.read("#{export_dir}/CustomButtons.yaml") - expect(YAML.safe_load(file_contents, [Symbol])).to contain_exactly(*multi_custom_button_export_test) + expect(YAML.safe_load(file_contents, :permitted_classes => [Symbol])).to contain_exactly(*multi_custom_button_export_test) expect(Dir[File.join(export_dir, '**', '*')].count { |file| File.file?(file) }).to eq(1) end end @@ -284,7 +284,7 @@ TaskHelpers::Exports::CustomButtons.new.export(:directory => export_dir) file_contents = File.read("#{export_dir}/CustomButtons.yaml") - expect(YAML.safe_load(file_contents, [Symbol])).to contain_exactly(*custom_button_with_dialogs_export_test) + expect(YAML.safe_load(file_contents, :permitted_classes => [Symbol])).to contain_exactly(*custom_button_with_dialogs_export_test) expect(Dir[File.join(export_dir, '**', '*')].count { |file| File.file?(file) }).to eq(1) end end diff --git a/spec/lib/task_helpers/exports/widgets_spec.rb b/spec/lib/task_helpers/exports/widgets_spec.rb index b23e52a0c18..07de69e85c5 100644 --- a/spec/lib/task_helpers/exports/widgets_spec.rb +++ b/spec/lib/task_helpers/exports/widgets_spec.rb @@ -26,7 +26,7 @@ resource_type: MiqReport enabled: true read_only: false - ", [Symbol], %i(col_order row_count roles))) + ", :permitted_classes => [Symbol])) MiqWidget.sync_from_hash(YAML.safe_load(" description: Test Widget 2 title: Test Widget 2 @@ -43,7 +43,7 @@ resource_type: MiqReport enabled: true read_only: false - ", [Symbol], %i(col_order row_count roles))) + ", :permitted_classes => [Symbol])) end after do diff --git a/spec/models/miq_widget_set_spec.rb b/spec/models/miq_widget_set_spec.rb index 5d8823583c1..7bb7516c9ad 100644 --- a/spec/models/miq_widget_set_spec.rb +++ b/spec/models/miq_widget_set_spec.rb @@ -202,7 +202,7 @@ let(:dashboard_name) { "Dashboard for Group" } before do @yml_file = Tempfile.new('default_dashboard_for_group.yaml') - yml_data = YAML.safe_load(<<~DOC, [Symbol]) + yml_data = YAML.safe_load(<<~DOC, :permitted_classes => [Symbol]) --- name: #{dashboard_name} read_only: t