2019-06-11 22:24:35 +00:00
|
|
|
require "helper"
|
|
|
|
require "inspec/resource"
|
|
|
|
require "inspec/resources/ksh"
|
2018-10-23 13:16:24 +00:00
|
|
|
|
|
|
|
describe Inspec::Resources::Ksh do
|
|
|
|
let(:x) { rand.to_s }
|
2019-06-11 22:24:35 +00:00
|
|
|
let(:resource) { load_resource("ksh", '$("' + x + '")') }
|
2018-10-23 13:16:24 +00:00
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
it "prints as a ksh command" do
|
|
|
|
resource.to_s.must_equal 'KornShell command $("' + x + '")'
|
2018-10-23 13:16:24 +00:00
|
|
|
end
|
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
it "wraps the command" do
|
2018-10-23 13:16:24 +00:00
|
|
|
resource.command.must_equal "ksh -c \\$\\(\\\"#{x}\\\"\\)"
|
|
|
|
end
|
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
it "can specify an executable path" do
|
|
|
|
resource = load_resource("ksh", '$("' + x + '")', path: "/bin/ksh")
|
2018-10-23 13:16:24 +00:00
|
|
|
resource.command.must_equal "/bin/ksh -c \\$\\(\\\"#{x}\\\"\\)"
|
|
|
|
end
|
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
it "can specify a arguments" do
|
|
|
|
resource = load_resource("ksh", '$("' + x + '")', args: "-x -c")
|
2018-10-23 13:16:24 +00:00
|
|
|
resource.command.must_equal "ksh -x -c \\$\\(\\\"#{x}\\\"\\)"
|
|
|
|
end
|
|
|
|
end
|