Sha256: cbe52706e1bd9f0f1ff43b3e3123d3440fc9ae9d16b82af244ee30f175b5fc0c

Contents?: true

Size: 1.97 KB

Versions: 22

Compression:

Stored size: 1.97 KB

Contents

require 'spec_helper'

include SpecInfra::Helper::Cmd
include SpecInfra::Helper::Windows

describe command('test_cmd /test/path/file') do
  let(:stdout) { "test output 1.2.3\r\n" }
  it { should return_stdout("test output 1.2.3") }
  its(:command) { should eq 'test_cmd /test/path/file' }
end

describe 'complete matching of stdout' do
  context command('test_cmd /test/path/file') 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('test_cmd /test/path/file') do
    let(:stdout) { "test output 1.2.3\r\n" }
    it { should return_stdout(/1\.2\.3/) }
  end
end

describe command('test_cmd /test/path/file') do
  let(:stderr) { "No such file or directory\r\n" }
  it { should return_stderr("No such file or directory") }
  its(:command) { should eq 'test_cmd /test/path/file' }
end

describe 'complete matching of stderr' do
  context command('test_cmd /test/path/file') 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('test_cmd /test/path/file') do
    let(:stderr) { "No such file or directory\r\n" }
    it { should return_stderr(/file/) }
  end
end

describe command('test_cmd /test/path/file') do
  it { should return_exit_status 0 }
  its(:command) { should eq 'test_cmd /test/path/file' }
end

describe command('dir "c:\"') do
  let(:stdout) { <<EOF
    Directory: C:\

Mode                LastWriteTime     Length Name
----                -------------     ------ ----
d-r--        23/09/2013  10:46 AM            Program Files
d-r--        23/09/2013   1:21 PM            Program Files (x86)
d----        17/10/2013   8:46 PM            temp
d-r--        23/09/2013  11:52 AM            Users
d----        23/09/2013   1:21 PM            Windows
EOF
    }

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

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
serverspec-1.16.0 spec/windows/command_spec.rb
serverspec-1.15.0 spec/windows/command_spec.rb
serverspec-1.14.0 spec/windows/command_spec.rb
serverspec-1.13.0 spec/windows/command_spec.rb
serverspec-1.12.0 spec/windows/command_spec.rb
serverspec-1.11.0 spec/windows/command_spec.rb
serverspec-1.10.0 spec/windows/command_spec.rb
serverspec-1.9.1 spec/windows/command_spec.rb
serverspec-1.9.0 spec/windows/command_spec.rb
serverspec-1.8.0 spec/windows/command_spec.rb
serverspec-1.7.1 spec/windows/command_spec.rb
serverspec-1.7.0 spec/windows/command_spec.rb
serverspec-1.6.0 spec/windows/command_spec.rb
serverspec-1.5.0 spec/windows/command_spec.rb
serverspec-1.4.2 spec/windows/command_spec.rb
serverspec-1.4.1 spec/windows/command_spec.rb
serverspec-1.4.0 spec/windows/command_spec.rb
serverspec-1.3.0 spec/windows/command_spec.rb
serverspec-1.2.0 spec/windows/command_spec.rb
serverspec-1.1.0 spec/windows/command_spec.rb