mirror of
https://github.com/inspec/inspec
synced 2024-11-26 22:50:36 +00:00
Ignore deprecation warning in fileutils and rubygems gems under ruby 2.7
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
This commit is contained in:
parent
e776337788
commit
a8b04769ca
3 changed files with 19 additions and 5 deletions
|
@ -59,4 +59,18 @@ module PluginManagerHelpers
|
|||
def teardown
|
||||
clear_empty_config_dir
|
||||
end
|
||||
|
||||
# This function exists because under Ruby 2.7 the rubygems gem issues deprecation warnings
|
||||
def assert_empty_ignoring_27_warnings(stderr)
|
||||
if Gem.ruby_version.segments[0, 2].join(".") == "2.7" # Assuming the deprecations are fixed in 2.8 and later
|
||||
# /usr/local/lib/ruby/site_ruby/2.7.0/rubygems.rb:475: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
|
||||
# /usr/local/lib/ruby/2.7.0/fileutils.rb:206: warning: The called method `mkdir_p' is defined here
|
||||
# /usr/local/lib/ruby/site_ruby/2.7.0/rubygems/package.rb:509: warning: Using the last argument as keyword parameters is deprecated
|
||||
# /usr/local/lib/ruby/site_ruby/2.7.0/rubygems/package.rb:489: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
|
||||
# /usr/local/lib/ruby/2.7.0/fileutils.rb:180: warning: The called method `mkdir' is defined here"
|
||||
stderr = stderr.split("\n").reject { |line| line =~ /(rubygems|fileutils).+warning.+(deprecated|defined)/ }
|
||||
end
|
||||
|
||||
assert_empty stderr
|
||||
end
|
||||
end
|
||||
|
|
|
@ -169,7 +169,7 @@ class PluginManagerCliInstall < Minitest::Test
|
|||
assert_equal "gem (user)", itf_plugin[:type]
|
||||
assert_equal "0.1.0", itf_plugin[:version]
|
||||
|
||||
assert_empty install_result.stderr
|
||||
assert_empty_ignoring_27_warnings install_result.stderr
|
||||
assert_exit_code 0, install_result
|
||||
end
|
||||
|
||||
|
@ -200,7 +200,7 @@ class PluginManagerCliInstall < Minitest::Test
|
|||
assert_equal "gem (user)", itf_plugin[:type]
|
||||
assert_equal "0.2.0", itf_plugin[:version]
|
||||
|
||||
assert_empty install_result.stderr
|
||||
assert_empty_ignoring_27_warnings install_result.stderr
|
||||
assert_exit_code 0, install_result
|
||||
end
|
||||
|
||||
|
@ -230,7 +230,7 @@ class PluginManagerCliInstall < Minitest::Test
|
|||
assert_equal "gem (user)", itf_plugin[:type]
|
||||
assert_equal "0.1.0", itf_plugin[:version]
|
||||
|
||||
assert_empty install_result.stderr
|
||||
assert_empty_ignoring_27_warnings install_result.stderr
|
||||
|
||||
assert_exit_code 0, install_result
|
||||
end
|
||||
|
@ -322,7 +322,7 @@ class PluginManagerCliInstall < Minitest::Test
|
|||
assert_equal "gem (user)", ttf_plugin[:type]
|
||||
assert_equal "0.1.0", ttf_plugin[:version]
|
||||
|
||||
assert_empty install_result.stderr
|
||||
assert_empty_ignoring_27_warnings install_result.stderr
|
||||
assert_exit_code 0, install_result
|
||||
end
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ class PluginManagerCliUpdate < Minitest::Test
|
|||
assert_equal "gem (user)", itf_plugin[:type]
|
||||
assert_equal "0.2.0", itf_plugin[:version]
|
||||
|
||||
assert_empty update_result.stderr
|
||||
assert_empty_ignoring_27_warnings update_result.stderr
|
||||
assert_exit_code 0, update_result
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue