Sha256: 97c17fe41de5157740256e10223b362e5e5b8e5b92207145c37452ead0b1d55a

Contents?: true

Size: 1.69 KB

Versions: 10

Compression:

Stored size: 1.69 KB

Contents

require 'spec_helper'

set :os, :family => 'base'

describe command('cat /etc/resolv.conf') do
  let(:stdout) { "nameserver 127.0.0.1\r\n" }
  it { should return_stdout("nameserver 127.0.0.1") }
end

describe 'complete matching of stdout' do
  context command('cat /etc/resolv.conf') do
    let(:stdout) { "foocontent-should-be-includedbar\r\n" }
    it { should_not return_stdout('content-should-be-included') }
  end
end

describe 'regexp matching of stdout' do
  context command('cat /etc/resolv.conf') do
    let(:stdout) { "nameserver 127.0.0.1\r\n" }
    it { should return_stdout(/127\.0\.0\.1/) }
  end
end

describe command('cat /etc/resolv.conf') do
  let(:stderr) { "No such file or directory\r\n" }
  it { should return_stderr("No such file or directory") }
end

describe 'complete matching of stderr' do
  context command('cat /etc/resolv.conf') do
    let(:stderr) { "No such file or directory\r\n" }
    it { should_not return_stderr('file') }
  end
end

describe 'regexp matching of stderr' do
  context command('cat /etc/resolv.conf') do
    let(:stderr) { "No such file or directory\r\n" }
    it { should return_stderr(/file/) }
  end
end

describe command('cat /etc/resolv.conf') do
  it { should return_exit_status 0 }
end

describe command('ls -al /') do
 let(:stdout) { <<EOF
total 88
drwxr-xr-x  23 root root  4096 Oct 10 17:19 .
drwxr-xr-x  23 root root  4096 Oct 10 17:19 ..
drwxr-xr-x   2 root root  4096 Sep 11 16:43 bin
drwxr-xr-x   3 root root  4096 Sep 23 18:14 boot
drwxr-xr-x  14 root root  4260 Oct 14 16:14 dev
drwxr-xr-x 104 root root  4096 Oct 14 17:34 etc
drwxr-xr-x   8 root root  4096 Oct  1 15:09 home
EOF
    }

  its(:stdout) { should match /bin/ }
  its(:stdout) { should eq stdout }
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
serverspec-2.0.0.beta18 spec/type/base/command_spec.rb
serverspec-2.0.0.beta17 spec/type/base/command_spec.rb
serverspec-2.0.0.beta16 spec/type/base/command_spec.rb
serverspec-2.0.0.beta15 spec/type/base/command_spec.rb
serverspec-2.0.0.beta14 spec/type/base/command_spec.rb
serverspec-2.0.0.beta13 spec/type/base/command_spec.rb
serverspec-2.0.0.beta12 spec/type/base/command_spec.rb
serverspec-2.0.0.beta11 spec/type/base/command_spec.rb
serverspec-2.0.0.beta10 spec/type/base/command_spec.rb
serverspec-2.0.0.beta9 spec/type/base/command_spec.rb