inspec/test/unit/resources/ksh_test.rb
Ryan Davis 07dc5e3192 First pass at cleaning deprecations for old minitest/spec-style tests.
3 files left to go, and they're behaving oddly so I'm leaving them out
in this pass. Looks like 21 deprecations left.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-10-03 13:45:19 -07:00

26 lines
777 B
Ruby

require "helper"
require "inspec/resource"
require "inspec/resources/ksh"
describe Inspec::Resources::Ksh do
let(:x) { rand.to_s }
let(:resource) { load_resource("ksh", '$("' + x + '")') }
it "prints as a ksh command" do
_(resource.to_s).must_equal 'KornShell command $("' + x + '")'
end
it "wraps the command" do
_(resource.command).must_equal "ksh -c \\$\\(\\\"#{x}\\\"\\)"
end
it "can specify an executable path" do
resource = load_resource("ksh", '$("' + x + '")', path: "/bin/ksh")
_(resource.command).must_equal "/bin/ksh -c \\$\\(\\\"#{x}\\\"\\)"
end
it "can specify a arguments" do
resource = load_resource("ksh", '$("' + x + '")', args: "-x -c")
_(resource.command).must_equal "ksh -x -c \\$\\(\\\"#{x}\\\"\\)"
end
end