Sha256: 6e9b61082b4cfd365078071200ab07423cf17d56d00ddee3a0190c3217b6f2c9

Contents?: true

Size: 753 Bytes

Versions: 16

Compression:

Stored size: 753 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(:execute).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

16 entries across 16 versions & 1 rubygems

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