inspec/test/unit/resources/ksh_test.rb
Miah Johnson 659b4b373a Remove # encoding: utf8 magic comments
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-05-07 16:06:23 -07:00

26 lines
719 B
Ruby

require 'helper'
require 'inspec/resource'
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