Sha256: 43384080ea2e5a1f13c7456062642d8816a6788ae1473f3099bfc3cc0cb1d018

Contents?: true

Size: 738 Bytes

Versions: 3

Compression:

Stored size: 738 Bytes

Contents

#! /usr/bin/env ruby

require 'spec_helper'

describe "lsbdistrelease 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 release through lsb_release -r -s 2>/dev/null" do
        Facter::Core::Execution.stubs(:exec).with('lsb_release -r -s 2>/dev/null').returns '2.1'
        Facter.fact(:lsbdistrelease).value.should == '2.1'
      end

      it "should return nil if lsb_release is not installed" do
        Facter::Core::Execution.stubs(:exec).with('lsb_release -r -s 2>/dev/null').returns nil
        Facter.fact(:lsbdistrelease).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/lsbdistrelease_spec.rb
facter-2.0.1.rc1-x86-mingw32 spec/unit/lsbdistrelease_spec.rb
facter-2.0.1.rc1-universal-darwin spec/unit/lsbdistrelease_spec.rb