Skip to content

Instantly share code, notes, and snippets.

@vinzent
Last active September 21, 2015 07:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vinzent/225722bdefeabffc88ee to your computer and use it in GitHub Desktop.
Save vinzent/225722bdefeabffc88ee to your computer and use it in GitHub Desktop.
# all checks will "fail", but check date output
#
# fails with: rspec test_spec.rb </dev/null
# works with: rspec test_spec.rb
require 'serverspec'
set :backend, :exec
describe 'test' do
describe command('date') do
its(:stdout) { should match /first date output/ }
end
describe command('script -qfc "sudo su - -c \'date; sleep 10\'"') do
its(:stdout) { should match /fail this to show stdout/ }
its(:stderr) { should match /fail this to show stderr/ }
end
describe command('date') do
its(:stdout) { should match /check date output if >=10s after first date output/ }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment