Sha256: 6ed40edf9f8beddf65391083d1487c34b7bff84f06e3b9b1f588ff552cd12001

Contents?: true

Size: 1.5 KB

Versions: 15

Compression:

Stored size: 1.5 KB

Contents

#! /usr/bin/env ruby -S rspec

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::Util::Resolution.stubs(:exec).with('oslevel -s').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::Util::Resolution.stubs(:exec).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::Util::Resolution.stubs(:exec).with('uname -r').returns("test_kernel")
    end 
    
    it "should return the kernel release" do
      Facter.fact(:kernelrelease).value.should == "test_kernel"
    end   
  end   
end 

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
facter-1.7.6 spec/unit/kernelrelease_spec.rb
facter-1.7.5 spec/unit/kernelrelease_spec.rb
facter-1.7.5.rc2 spec/unit/kernelrelease_spec.rb
facter-1.7.5.rc1 spec/unit/kernelrelease_spec.rb
facter-1.7.4 spec/unit/kernelrelease_spec.rb
facter-1.7.4.rc1 spec/unit/kernelrelease_spec.rb
facter-1.7.3 spec/unit/kernelrelease_spec.rb
facter-1.7.3.rc1 spec/unit/kernelrelease_spec.rb
facter-1.7.2 spec/unit/kernelrelease_spec.rb
facter-1.7.2.rc1 spec/unit/kernelrelease_spec.rb
facter-1.7.1 spec/unit/kernelrelease_spec.rb
facter-1.7.1.rc1 spec/unit/kernelrelease_spec.rb
facter-1.7.0 spec/unit/kernelrelease_spec.rb
facter-1.7.0.rc2 spec/unit/kernelrelease_spec.rb
facter-1.7.0.rc1 spec/unit/kernelrelease_spec.rb