2 RSpec.configure do |config|
3 config.mock_with :rspec
6 describe Facter::Util::Fact do
7 before { Facter.clear }
9 describe 'erl_ssl_path' do
10 context 'with valid value' do
12 allow(Facter::Util::Resolution).to receive(:which).with('erl') { true }
13 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"' }
17 expect(Facter.fact(:erl_ssl_path).value).to eq('/usr/lib64/erlang/lib/ssl-5.3.3/ebin')
21 context 'with error message' do
23 allow(Facter::Util::Resolution).to receive(:which).with('erl') { true }
24 allow(Facter::Core::Execution).to receive(:execute).with("erl -eval 'io:format(\"~p\", [code:lib_dir(ssl, ebin)]),halt().' -noshell") { '{error,bad_name}' }
28 expect(Facter.fact(:erl_ssl_path).value).to be_nil
32 context 'with erl not present' do
34 allow(Facter::Util::Resolution).to receive(:which).with('erl') { false }
38 expect(Facter.fact(:erl_ssl_path).value).to be_nil