Sha256: df28963da0437c4b82391788ebb2b0f6c94f060b3476cf0c6bab2db061cfbd00

Contents?: true

Size: 1.92 KB

Versions: 7

Compression:

Stored size: 1.92 KB

Contents

require 'spec_helper'
require 'specinfra/helper/detect_os/aix'

describe Specinfra::Helper::DetectOs::Aix do
  aix = Specinfra::Helper::DetectOs::Aix.new(:exec)
  it 'Should return aix 10.11 powerpc when (fictional) AIX 10.11 is installed.' do
    allow(aix).to receive(:run_command).with('uname -s') {
      CommandResult.new(:stdout => 'AIX', :exit_status => 0)
    }
    allow(aix).to receive(:run_command).with('uname -rvp') {
      CommandResult.new(:stdout => '11 10 powerpc', :exit_status => 0)
    }
    expect(aix.detect).to include(
      :family  => 'aix',
      :release => '10.11',
      :arch    => 'powerpc'
    )
  end
  it 'Should return aix 7.1 powerpc when AIX 7.1 is installed.' do
    allow(aix).to receive(:run_command).with('uname -s') {
      CommandResult.new(:stdout => 'AIX', :exit_status => 0)
    }
    allow(aix).to receive(:run_command).with('uname -rvp') {
      CommandResult.new(:stdout => '1 7 powerpc', :exit_status => 0)
    }
    expect(aix.detect).to include(
      :family  => 'aix',
      :release => '7.1',
      :arch    => 'powerpc'
    )
  end
  it 'Should return aix 6.1 powerpc when AIX 6.1 is installed.' do
    allow(aix).to receive(:run_command).with('uname -s') {
      CommandResult.new(:stdout => 'AIX', :exit_status => 0)
    }
    allow(aix).to receive(:run_command).with('uname -rvp') {
      CommandResult.new(:stdout => '1 6 powerpc', :exit_status => 0)
    }
    expect(aix.detect).to include(
      :family  => 'aix',
      :release => '6.1',
      :arch    => 'powerpc'
    )
  end
  it 'Should return aix when AIX is installed.' do
    allow(aix).to receive(:run_command).with('uname -s') {
      CommandResult.new(:stdout => 'AIX', :exit_status => 0)
    }
    allow(aix).to receive(:run_command).with('uname -rvp') {
      CommandResult.new(:stdout => '', :exit_status => 1)
    }
    expect(aix.detect).to include(
      :family  => 'aix',
      :release => nil,
      :arch    => nil
    )
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
specinfra-2.36.17 spec/helper/detect_os/aix_spec.rb
specinfra-2.36.16 spec/helper/detect_os/aix_spec.rb
specinfra-2.36.15 spec/helper/detect_os/aix_spec.rb
specinfra-2.36.14 spec/helper/detect_os/aix_spec.rb
specinfra-2.36.13 spec/helper/detect_os/aix_spec.rb
specinfra-2.36.12 spec/helper/detect_os/aix_spec.rb
specinfra-2.36.11 spec/helper/detect_os/aix_spec.rb