Sha256: 2d050b2fc76f9b7301632e73136863efceff8e8f79c2687df3254d973b8374a8

Contents?: true

Size: 1.89 KB

Versions: 20

Compression:

Stored size: 1.89 KB

Contents

require 'spec_helper'

include SpecInfra::Helper::Solaris

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") }
  its(:command) { should eq 'cat /etc/resolv.conf' }
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(:stdout) { "No such file or directory\r\n" }
  it { should return_stderr("No such file or directory") }
  its(:command) { should eq 'cat /etc/resolv.conf' }
end

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

describe 'regexp matching of stderr' do
  context command('cat /etc/resolv.conf') do
    let(:stdout) { "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 }
  its(:command) { should eq 'cat /etc/resolv.conf' }
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(:stderr) { should match /bin/ }

  its(:stdout) { should eq stdout }
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
serverspec-0.15.5 spec/solaris/command_spec.rb
serverspec-0.15.4 spec/solaris/command_spec.rb
serverspec-0.15.3 spec/solaris/command_spec.rb
serverspec-0.15.2 spec/solaris/command_spec.rb
serverspec-0.15.1 spec/solaris/command_spec.rb
serverspec-0.15.0 spec/solaris/command_spec.rb
serverspec-0.14.4 spec/solaris/command_spec.rb
serverspec-0.14.3 spec/solaris/command_spec.rb
serverspec-0.14.2 spec/solaris/command_spec.rb
serverspec-0.14.1 spec/solaris/command_spec.rb
serverspec-0.14.0 spec/solaris/command_spec.rb
serverspec-0.13.7 spec/solaris/command_spec.rb
serverspec-0.13.6 spec/solaris/command_spec.rb
serverspec-0.13.5 spec/solaris/command_spec.rb
serverspec-0.13.4 spec/solaris/command_spec.rb
serverspec-0.13.3 spec/solaris/command_spec.rb
serverspec-0.13.2 spec/solaris/command_spec.rb
serverspec-0.13.1 spec/solaris/command_spec.rb
serverspec-0.13.0 spec/solaris/command_spec.rb
serverspec-0.12.0 spec/solaris/command_spec.rb