Skip to content

Commit

Permalink
do not confine smartd fact to linux
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshua Hoblitt committed Apr 11, 2014
1 parent 8cbfc2b commit 57af86d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
2 changes: 0 additions & 2 deletions lib/facter/smartd.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
Facter.add(:smartd) do
confine :kernel => :linux

setcode do
Facter::Util::Resolution.which('smartd')
end
Expand Down
23 changes: 9 additions & 14 deletions spec/unit/facts/smartd_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,18 @@
describe 'smartd', :type => :fact do
before(:each) { Facter.clear }

context 'on linux' do
context 'not in path' do
it do
Facter.fact(:kernel).stubs(:value).returns('Linux')
Facter::Util::Resolution.stubs(:which).with('smartd').returns(nil)
Facter.fact(:smartd).value.should be_nil
end
context 'not in path' do
it do
Facter::Util::Resolution.stubs(:which).with('smartd').returns(nil)
Facter.fact(:smartd).value.should be_nil
end
end

context 'in path' do
it do
Facter.fact(:kernel).stubs(:value).returns('Linux')
Facter::Util::Resolution.stubs(:which).with('smartd').returns('/usr/sbin/smartd')
Facter.fact(:smartd).value.should == '/usr/sbin/smartd'
end
context 'in path' do
it do
Facter::Util::Resolution.stubs(:which).with('smartd').returns('/usr/sbin/smartd')
Facter.fact(:smartd).value.should == '/usr/sbin/smartd'
end
end

end

0 comments on commit 57af86d

Please sign in to comment.