Sha256: 478150938e9e9dedfefe4ae39d66da08e289da6a6682fa97b56c5fc2419f0135

Contents?: true

Size: 736 Bytes

Versions: 3

Compression:

Stored size: 736 Bytes

Contents

#! /usr/bin/env ruby

require 'spec_helper'

describe "lsbdistid fact" do

  [ "Linux", "GNU/kFreeBSD"].each do |kernel|
    describe "on #{kernel}" do
      before :each do
        Facter.fact(:kernel).stubs(:value).returns kernel
      end

      it "should return the id through lsb_release -i -s 2>/dev/null" do
        Facter::Core::Execution.stubs(:exec).with('lsb_release -i -s 2>/dev/null').returns 'Gentoo'
        Facter.fact(:lsbdistid).value.should == 'Gentoo'
      end

      it "should return nil if lsb_release is not installed 2>/dev/null" do
        Facter::Core::Execution.stubs(:exec).with('lsb_release -i -s 2>/dev/null').returns nil
        Facter.fact(:lsbdistid).value.should be_nil
      end
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
facter-2.0.1.rc1 spec/unit/lsbdistid_spec.rb
facter-2.0.1.rc1-x86-mingw32 spec/unit/lsbdistid_spec.rb
facter-2.0.1.rc1-universal-darwin spec/unit/lsbdistid_spec.rb