Sha256: 7c9b29923c5ecef83a06cec6b71a4b48e26689e9e321d21ac897a8da180a2006

Contents?: true

Size: 1.47 KB

Versions: 12

Compression:

Stored size: 1.47 KB

Contents

#! /usr/bin/env ruby

require 'spec_helper'

describe "Kernel release fact" do

  describe "on Windows" do
    before do
      Facter.fact(:kernel).stubs(:value).returns("windows")
      require 'facter/util/wmi'
      version = stubs 'version'
      version.stubs(:Version).returns("test_kernel")
      Facter::Util::WMI.stubs(:execquery).with("SELECT Version from Win32_OperatingSystem").returns([version])
    end

    it "should return the kernel release" do
      Facter.fact(:kernelrelease).value.should == "test_kernel"
    end
  end

  describe "on AIX" do
    before do
      Facter.fact(:kernel).stubs(:value).returns("aix")
      Facter::Core::Execution.stubs(:execute).with('oslevel -s', anything).returns("test_kernel")
    end

    it "should return the kernel release" do
      Facter.fact(:kernelrelease).value.should == "test_kernel"
    end
  end

  describe "on HP-UX" do
    before do
      Facter.fact(:kernel).stubs(:value).returns("hp-ux")
      Facter::Core::Execution.stubs(:execute).with('uname -r').returns("B.11.31")
    end

    it "should remove preceding letters" do
      Facter.fact(:kernelrelease).value.should == "11.31"
    end
  end

  describe "on everything else" do
    before do
      Facter.fact(:kernel).stubs(:value).returns("linux")
      Facter::Core::Execution.stubs(:execute).with('uname -r', anything).returns("test_kernel")
    end

    it "should return the kernel release" do
      Facter.fact(:kernelrelease).value.should == "test_kernel"
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
facter-2.0.2 spec/unit/kernelrelease_spec.rb
facter-2.0.2-x86-mingw32 spec/unit/kernelrelease_spec.rb
facter-2.0.2-universal-darwin spec/unit/kernelrelease_spec.rb
facter-2.0.1 spec/unit/kernelrelease_spec.rb
facter-2.0.1-x86-mingw32 spec/unit/kernelrelease_spec.rb
facter-2.0.1-universal-darwin spec/unit/kernelrelease_spec.rb
facter-2.0.1.rc4 spec/unit/kernelrelease_spec.rb
facter-2.0.1.rc4-x86-mingw32 spec/unit/kernelrelease_spec.rb
facter-2.0.1.rc4-universal-darwin spec/unit/kernelrelease_spec.rb
facter-2.0.1.rc3 spec/unit/kernelrelease_spec.rb
facter-2.0.1.rc3-x86-mingw32 spec/unit/kernelrelease_spec.rb
facter-2.0.1.rc3-universal-darwin spec/unit/kernelrelease_spec.rb