Sha256: e907e21be366f711f5b4e49949a930999b129079222f40ddeddbcb4f10306831

Contents?: true

Size: 1.8 KB

Versions: 6

Compression:

Stored size: 1.8 KB

Contents

require 'spec_helper'

include Specinfra::Helper::Cmd

set :os, :family => '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") }
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") }
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 }
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

6 entries across 6 versions & 1 rubygems

Version Path
serverspec-2.0.0.beta14 spec/type/windows/command_spec.rb
serverspec-2.0.0.beta13 spec/type/windows/command_spec.rb
serverspec-2.0.0.beta12 spec/type/windows/command_spec.rb
serverspec-2.0.0.beta11 spec/type/windows/command_spec.rb
serverspec-2.0.0.beta10 spec/type/windows/command_spec.rb
serverspec-2.0.0.beta9 spec/type/windows/command_spec.rb