inspec/test/unit/resources/bash_test.rb
Miah Johnson 2a1b1d8e88 Remove all leading newlines.
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-05-31 11:43:44 -07:00

26 lines
756 B
Ruby

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