Codebase list facter / 92aba90
(maint) Confine lsbdistdescription to depend on lsb_release Adrien Thebo 10 years ago
2 changed file(s) with 10 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
1111
1212 Facter.add(:lsbdistdescription) do
1313 confine :kernel => [ :linux, :"gnu/kfreebsd" ]
14 confine do
15 Facter::Core::Execution.which("lsb_release")
16 end
17
1418 setcode do
1519 if output = Facter::Core::Execution.exec('lsb_release -d -s 2>/dev/null')
1620 # the output may be quoted (at least it is on gentoo)
99 Facter.fact(:kernel).stubs(:value).returns kernel
1010 end
1111
12 it "should return the description through lsb_release -d -s 2>/dev/null" do
13 Facter::Core::Execution.stubs(:exec).with('lsb_release -d -s 2>/dev/null').returns '"Gentoo Base System release 2.1"'
14 Facter.fact(:lsbdistdescription).value.should == 'Gentoo Base System release 2.1'
12 it "returns the description through lsb_release -d -s 2>/dev/null" do
13 Facter::Core::Execution.impl.stubs(:exec).with('lsb_release -d -s 2>/dev/null', anything).returns '"Gentoo Base System release 2.1"'
14 expect(Facter.fact(:lsbdistdescription).value).to eq 'Gentoo Base System release 2.1'
1515 end
1616
17 it "should return nil if lsb_release is not installed" do
18 Facter::Core::Execution.stubs(:exec).with('lsb_release -d -s 2>/dev/null').returns nil
19 Facter.fact(:lsbdistdescription).value.should be_nil
17 it "returns nil if lsb_release is not installed" do
18 Facter::Core::Execution.stubs(:which).with('lsb_release').returns nil
19 expect(Facter.fact(:lsbdistdescription).value).to be_nil
2020 end
2121 end
2222 end
23
2423 end