From 3f1c3c035e90768897b84ca9a8fa2915056be32d Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Mon, 1 Jul 2024 10:00:33 +0200 Subject: [PATCH] Fixes #37613 - compare parsed YAML results, not Strings depending on the libyaml version, it encodes `nil` differently and thus the tests fail on newer versions as the *string* comparison fails. if we parse the generated yaml back into a Hash, things compare just fine again, without breaking the tests on older libyaml versions. --- test/unit/foreman/renderer/scope/report_test.rb | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/test/unit/foreman/renderer/scope/report_test.rb b/test/unit/foreman/renderer/scope/report_test.rb index 46cfe6448fd..6a42a2cb3c3 100644 --- a/test/unit/foreman/renderer/scope/report_test.rb +++ b/test/unit/foreman/renderer/scope/report_test.rb @@ -93,18 +93,8 @@ class ReportScopeTest < ActiveSupport::TestCase expected_csv = "List,String,Number,Bool,Empty,Nil\n\"Val1,1,true\",Text,1,false,\"\",\"\"\n" assert_equal expected_csv, @scope.report_render(format: :csv) - expected_yaml = <<~OUT + " Nil: \n" - --- - - List: - - Val1 - - 1 - - true - String: Text - Number: 1 - Bool: false - Empty: '' - OUT - assert_equal expected_yaml, @scope.report_render(format: :yaml) + expected_yaml = [{"List" => ["Val1", 1, true], "String" => "Text", "Number" => 1, "Bool" => false, "Empty" => "", "Nil" => nil}] + assert_equal expected_yaml, YAML.safe_load(@scope.report_render(format: :yaml)) end end end