Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #37613 - compare parsed YAML results, not Strings #10230

Merged
merged 1 commit into from
Jul 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions test/unit/foreman/renderer/scope/report_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could equally be

Suggested change
assert_equal expected_yaml, YAML.safe_load(@scope.report_render(format: :yaml))
assert_equal expected_yaml.to_yaml, @scope.report_render(format: :yaml)

but I think that's uglier?

end
end
end
Loading