Sha256: 59e369c196877e94d00d93956b59b338b232d97c080cb7f7df609a89b5a001c0

Contents?: true

Size: 1.72 KB

Versions: 1

Compression:

Stored size: 1.72 KB

Contents

require 'spec_helper'
require 'specinfra/helper/detect_os/suse'

describe Specinfra::Helper::DetectOs::Suse do
  suse = Specinfra::Helper::DetectOs::Suse.new(:exec)
  it 'Should return opensuse 42 when openSUSE 42.2 is installed.' do
    allow(suse).to receive(:run_command) {
        CommandResult.new(:stdout => 'NAME=\"openSUSE Leap\"\nVERSION=\"42.2\"\nID=opensuse\nID_LIKE=\"suse\"\nVERSION_ID=\"42.2\"\nPRETTY_NAME=\"openSUSE Leap 42.2\"\nANSI_COLOR=\"0;32\"\nCPE_NAME=\"cpe:/o:opensuse:leap:42.2\"\nBUG_REPORT_URL=\"https://bugs.opensuse.org\"\nHOME_URL=\"https://www.opensuse.org/\"\n', :exit_status => 0)
    }
    expect(suse.detect).to include(
      :family  => 'opensuse',
      :release => '42.2'
    )
  end
  it 'Should return opensuse 13.2 when openSUSE 13.2 is installed.' do
    allow(suse).to receive(:run_command) {
        CommandResult.new(:stdout => 'NAME=openSUSE\nVERSION=\"13.2 (Harlequin)\"\nVERSION_ID=\"13.2\"\nPRETTY_NAME=\"openSUSE 13.2 (Harlequin) (x86_64)\"\nID=opensuse\nANSI_COLOR=\"0;32\"\nCPE_NAME=\"cpe:/o:opensuse:opensuse:13.2\"\nBUG_REPORT_URL=\"https://bugs.opensuse.org\"\nHOME_URL=\"https://opensuse.org/\"\nID_LIKE=\"suse\"\n', :exit_status => 0)
    }
    expect(suse.detect).to include(
      :family  => 'opensuse',
      :release => '13.2'
    )
  end
  it 'Should return sles 12 when SUSE Linux Enterprise Server 12 is installed.' do
    allow(suse).to receive(:run_command) {
      CommandResult.new(:stdout => 'NAME=\"SLES\"\nVERSION=\"12\"\nVERSION_ID=\"12\"\nPRETTY_NAME=\"SUSE Linux Enterprise Server 12\"\nID=\"sles\"\nANSI_COLOR=\"0;32\"\nCPE_NAME=\"cpe:/o:suse:sles:12\"\n', :exit_status => 0)
    }
    expect(suse.detect).to include(
      :family  => 'sles',
      :release => '12'
    )
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
specinfra-2.67.6 spec/helper/detect_os/suse_spec.rb