Sha256: c11c039ae38d3a6c090143d0f47eb98a350008844c823c586fcc38f4c585439c

Contents?: true

Size: 758 Bytes

Versions: 3

Compression:

Stored size: 758 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', anything).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', anything).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.rc2 spec/unit/lsbdistrelease_spec.rb
facter-2.0.1.rc2-x86-mingw32 spec/unit/lsbdistrelease_spec.rb
facter-2.0.1.rc2-universal-darwin spec/unit/lsbdistrelease_spec.rb