Sha256: 395b143b0248956d9d0658d3ccdc389e63efa27ce14a6d0c60301fa16bec415b

Contents?: true

Size: 750 Bytes

Versions: 3

Compression:

Stored size: 750 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 "returns the id through lsb_release -i -s 2>/dev/null" do
        Facter::Core::Execution.impl.stubs(:exec).with('lsb_release -i -s 2>/dev/null', anything).returns 'Gentoo'
        expect(Facter.fact(:lsbdistid).value).to eq 'Gentoo'
      end

      it "returns nil if lsb_release is not installed" do
        Facter::Core::Execution.impl.stubs(:expand_command).with('lsb_release -i -s 2>/dev/null').returns nil
        expect(Facter.fact(:lsbdistid).value).to 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/lsbdistid_spec.rb
facter-2.0.1.rc2-x86-mingw32 spec/unit/lsbdistid_spec.rb
facter-2.0.1.rc2-universal-darwin spec/unit/lsbdistid_spec.rb