3 describe Facter::Util::Fact do
4 before { Facter.clear }
6 describe 'erl_ssl_path' do
7 context 'with valid value' do
9 allow(Facter::Util::Resolution).to receive(:which).with('erl') { true }
10 allow(Facter::Core::Execution).to receive(:execute).with("erl -eval 'io:format(\"~p\", [code:lib_dir(ssl, ebin)]),halt().' -noshell") { '"/usr/lib64/erlang/lib/ssl-5.3.3/ebin"' }
14 expect(Facter.fact(:erl_ssl_path).value).to eq('/usr/lib64/erlang/lib/ssl-5.3.3/ebin')
18 context 'with error message' do
20 allow(Facter::Util::Resolution).to receive(:which).with('erl') { true }
21 allow(Facter::Core::Execution).to receive(:execute).with("erl -eval 'io:format(\"~p\", [code:lib_dir(ssl, ebin)]),halt().' -noshell") { '{error,bad_name}' }
25 expect(Facter.fact(:erl_ssl_path).value).to be_nil
29 context 'with erl not present' do
31 allow(Facter::Util::Resolution).to receive(:which).with('erl') { false }
35 expect(Facter.fact(:erl_ssl_path).value).to be_nil