Sha256: d39d4238604bfddacea9f1943998f1098c05a040c23df6140d64d554c8ed8865

Contents?: true

Size: 1.38 KB

Versions: 37

Compression:

Stored size: 1.38 KB

Contents

require 'spec_helper'

include Serverspec::Helper::RedHat

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

Version data entries

37 entries across 35 versions & 1 rubygems

Version Path
serverspec-0.7.2 spec/redhat/command_spec.rb
serverspec-0.7.1 spec/redhat/command_spec.rb
serverspec-0.7.0 spec/redhat/command_spec.rb
serverspec-0.6.30 spec/redhat/command_spec.rb
serverspec-0.6.29 spec/redhat/command_spec.rb
serverspec-0.6.28 spec/redhat/command_spec.rb
serverspec-0.6.27 spec/redhat/command_spec.rb
serverspec-0.6.26 spec/redhat/command_spec.rb
serverspec-0.6.25 spec/redhat/command_spec.rb
serverspec-0.6.24 spec/redhat/command_spec.rb
serverspec-0.6.23 spec/redhat/command_spec.rb
serverspec-0.6.22 spec/redhat/command_spec.rb
serverspec-0.6.21 spec/redhat/command_spec.rb
serverspec-0.6.20 spec/redhat/command_spec.rb
serverspec-0.6.19 spec/redhat/command_spec.rb
serverspec-0.6.18 spec/redhat/command_spec.rb
serverspec-0.6.17 spec/redhat/command_spec.rb