Sha256: d1e36234a3cd42cd35b8e6eae3248fbdefea0633486f8bb6264b8ed7a9b5782f

Contents?: true

Size: 895 Bytes

Versions: 19

Compression:

Stored size: 895 Bytes

Contents

#! /usr/bin/env ruby

require 'spec_helper'

describe "lsbdistdescription fact" do

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

      it "returns the description through lsb_release -d -s 2>/dev/null" do
        Facter::Core::Execution.stubs(:which).with('lsb_release').returns '/usr/bin/lsb_release'
        Facter::Core::Execution.stubs(:exec).with('lsb_release -d -s 2>/dev/null', anything).returns '"Gentoo Base System release 2.1"'
        expect(Facter.fact(:lsbdistdescription).value).to eq 'Gentoo Base System release 2.1'
      end

      it "returns nil if lsb_release is not installed" do
        Facter::Core::Execution.stubs(:which).with('lsb_release').returns nil
        expect(Facter.fact(:lsbdistdescription).value).to be_nil
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
facter-2.1.0 spec/unit/lsbdistdescription_spec.rb
facter-2.1.0-x86-mingw32 spec/unit/lsbdistdescription_spec.rb
facter-2.1.0-x64-mingw32 spec/unit/lsbdistdescription_spec.rb
facter-2.1.0-universal-darwin spec/unit/lsbdistdescription_spec.rb
facter-2.0.2 spec/unit/lsbdistdescription_spec.rb
facter-2.0.2-x86-mingw32 spec/unit/lsbdistdescription_spec.rb
facter-2.0.2-universal-darwin spec/unit/lsbdistdescription_spec.rb
facter-2.0.1 spec/unit/lsbdistdescription_spec.rb
facter-2.0.1-x86-mingw32 spec/unit/lsbdistdescription_spec.rb
facter-2.0.1-universal-darwin spec/unit/lsbdistdescription_spec.rb
facter-2.0.1.rc4 spec/unit/lsbdistdescription_spec.rb
facter-2.0.1.rc4-x86-mingw32 spec/unit/lsbdistdescription_spec.rb
facter-2.0.1.rc4-universal-darwin spec/unit/lsbdistdescription_spec.rb
facter-2.0.1.rc3 spec/unit/lsbdistdescription_spec.rb
facter-2.0.1.rc3-x86-mingw32 spec/unit/lsbdistdescription_spec.rb
facter-2.0.1.rc3-universal-darwin spec/unit/lsbdistdescription_spec.rb
facter-2.0.1.rc2 spec/unit/lsbdistdescription_spec.rb
facter-2.0.1.rc2-x86-mingw32 spec/unit/lsbdistdescription_spec.rb
facter-2.0.1.rc2-universal-darwin spec/unit/lsbdistdescription_spec.rb