inspec/test/resource/command_test.rb

34 lines
718 B
Ruby
Raw Normal View History

2015-09-25 17:16:07 +00:00
# encoding: utf-8
2015-10-06 16:55:44 +00:00
# author: Dominik Richter
# author: Christoph Hartmann
2015-10-05 21:46:33 +00:00
describe command('echo hello') do
its(:stdout) { should eq "hello\n" }
2015-09-25 17:16:07 +00:00
its(:stderr) { should eq '' }
its(:exit_status) { should eq 0 }
end
describe command('>&2 echo error') do
2015-09-25 17:16:07 +00:00
its(:stdout) { should eq '' }
its(:stderr) { should eq "error\n" }
its(:exit_status) { should eq 0 }
end
describe command('exit 123') do
2015-09-25 17:16:07 +00:00
its(:stdout) { should eq '' }
its(:stderr) { should eq '' }
its(:exit_status) { should eq 123 }
end
describe command('/bin/sh').exist? do
it { should eq true }
end
describe command('sh').exist? do
it { should eq true }
end
describe command('this is not existing').exist? do
it { should eq false }
end