Commit 6393787d authored by Nathan Ward's avatar Nathan Ward
Browse files

Only capture the exec for `radiusd -v` - facter etc. runs `uname -s` and...

Only capture the exec for `radiusd -v` - facter etc. runs `uname -s` and whatever else, so things get confused.
parent 9d3ad04e
......@@ -4,7 +4,15 @@ require 'facter/freeradius_version'
describe 'freeradius_version', type: :fact do
before :each do
Facter.clear
allow(Facter::Core::Execution).to receive(:exec).with('radiusd -v').and_return('FreeRADIUS Version 3.0.21')
orig_exec_method = Facter::Core::Execution.method(:exec)
allow(Facter::Core::Execution).to receive(:exec) do |cmd|
case cmd
when 'radiusd -v'
'FreeRADIUS Version 3.0.21'
else
orig_exec_method.call(cmd)
end
end
end
it 'sets freeradius_version' do
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment