inspec/test/unit/resources/bash_test.rb
Ryan Davis adaf2bc364 Removed aws resource requiring from test/helper and inspec/resource.
This speeds up parallel unit test runs from a very consistent 2:49 to
a very consistent 1:53, or a 33% reduction.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-29 17:58:02 -07:00

25 lines
699 B
Ruby

require 'helper'
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