inspec/test/runner/tests/run_command_test.rb
2015-09-22 02:17:29 +02:00

25 lines
652 B
Ruby

describe 'run_command' do
let(:backend) { get_backend.call() }
it 'can echo commands' do
res = backend.run_command('echo hello world')
res.stdout.must_equal("hello world\n")
res.stderr.must_equal('')
res.exit_status.must_equal(0)
end
it 'can echo commands to stderr' do
res = backend.run_command('>&2 echo hello world')
res.stdout.must_equal('')
res.stderr.must_equal("hello world\n")
res.exit_status.must_equal(0)
end
it 'prints a correct exit status' do
res = backend.run_command('exit 123')
res.stdout.must_equal('')
res.stderr.must_equal('')
res.exit_status.must_equal(123)
end
end