File: fact_erl_ssl_path_spec.rb

package info (click to toggle)
puppet-module-puppetlabs-rabbitmq 8.5.0-10
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,192 kB
  • sloc: ruby: 5,227; sh: 10; makefile: 4
file content (30 lines) | stat: -rw-r--r-- 1,101 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
require 'spec_helper'

describe Facter::Util::Fact do
  before { Facter.clear }

  describe 'erl_ssl_path' do
    context 'with valid value' do
      it do
        Facter::Util::Resolution.expects(:which).with('erl').returns(true)
        Facter::Core::Execution.expects(:execute).with("erl -eval 'io:format(\"~p\", [code:lib_dir(ssl, ebin)]),halt().' -noshell").returns('"/usr/lib64/erlang/lib/ssl-5.3.3/ebin"')
        expect(Facter.fact(:erl_ssl_path).value).to eq('/usr/lib64/erlang/lib/ssl-5.3.3/ebin')
      end
    end

    context 'with error message' do
      it do
        Facter::Util::Resolution.expects(:which).with('erl').returns(true)
        Facter::Core::Execution.expects(:execute).with("erl -eval 'io:format(\"~p\", [code:lib_dir(ssl, ebin)]),halt().' -noshell").returns('{error,bad_name}')
        expect(Facter.fact(:erl_ssl_path).value).to be_nil
      end
    end

    context 'with erl not present' do
      it do
        Facter::Util::Resolution.expects(:which).with('erl').returns(false)
        expect(Facter.fact(:erl_ssl_path).value).to be_nil
      end
    end
  end
end