Fix env smoke test by updating ERB.new in inspec env; add additional test (#6342) (#6740)

* Failing test for Ruby 3.1 - ERB.new call options changed



* Fix for Ruby 3.1 by using named params to ERB.new



* Restrict test to non-windows systems



* Restrict test to non-windows systems

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
Co-authored-by: Clinton Wolfe <clintoncwolfe@gmail.com>
This commit is contained in:
Vasundhara Jagdale 2023-09-30 10:02:38 +00:00 committed by GitHub
parent b1a81155d5
commit 96750dea83
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 1 deletions

View file

@ -35,7 +35,7 @@ module Inspec
private
def print_completion_for_shell
erb = ERB.new(File.read(completion_template_path), nil, "-")
erb = ERB.new(File.read(completion_template_path), trim_mode: "-")
puts erb.result(TemplateContext.new(@command_class).get_bindings)
end

View file

@ -0,0 +1,23 @@
require "functional/helper"
describe "inspec env" do
include FunctionalHelper
parallelize_me!
describe "inspec env with no args" do
# env is a command only supported for
# bash, zsh, and fish shells - so mac and linux
unless windows?
it "runs without warnings" do
result = run_inspec_process("env")
assert_empty result.stderr
assert_exit_code 0, result
# Part of the successful help usage message at the end, not likely to change
_(result.stdout).must_include "inspec env SHELLNAME"
end
end
end
end