UNIT_TESTS: update yaml reporter test for Ruby 3+

Signed-off-by: Marijus Ravickas <marijus.ravickas@gmail.com>
This commit is contained in:
Chef Expeditor 2022-05-05 00:17:10 +00:00 committed by Marijus Ravickas
parent 79f11561fb
commit 1d672feca4
No known key found for this signature in database
GPG key ID: AD840C767763DD2B
3 changed files with 7 additions and 3 deletions

View file

@ -139,6 +139,10 @@ def expect_deprecation(group, &block)
handle_deprecations(group => :expect_something, all_others: :tolerate, &block) handle_deprecations(group => :expect_something, all_others: :tolerate, &block)
end end
def darwin?
!!(RbConfig::CONFIG["host_os"] =~ /darwin/)
end
class Minitest::Test class Minitest::Test
# TODO: push up to minitest # TODO: push up to minitest
def skip_until(y, m, d, msg) def skip_until(y, m, d, msg)

View file

@ -11,10 +11,10 @@ describe Inspec::Reporters::Yaml do
describe "#render" do describe "#render" do
it "confirm render output" do it "confirm render output" do
if windows? && RUBY3_PLUS if ( windows? || darwin? ) && RUBY3_PLUS
# Under Windows on Ruby 3+, empty scalar values are generated without a trailing space # On Ruby 3+, empty scalar values are generated without a trailing space
# this affects the title: and desc: fields # this affects the title: and desc: fields
output = File.read("test/fixtures/reporters/yaml_output_windows_ruby3plus") output = File.read("test/fixtures/reporters/yaml_output_ruby3plus")
else else
output = File.read("test/fixtures/reporters/yaml_output") output = File.read("test/fixtures/reporters/yaml_output")
end end