2 require 'facter/facter_dot_d'
4 describe Facter::Util::DotD do # rubocop:disable RSpec/FilePath : Spec path is as it should be
5 context 'with a simple fact' do
7 allow(Facter).to receive(:version).and_return('1.6.1')
8 allow(subject).to receive(:entries).and_return(['/etc/facter/facts.d/fake_fact.txt'])
9 allow(File).to receive(:readlines).with('/etc/facter/facts.d/fake_fact.txt').and_return(['fake_fact=fake fact'])
13 it 'returns successfully' do
14 expect(Facter.fact(:fake_fact).value).to eq('fake fact')
18 context 'with a fact with equals signs' do
20 allow(Facter).to receive(:version).and_return('1.6.1')
21 allow(subject).to receive(:entries).and_return(['/etc/facter/facts.d/foo.txt'])
22 allow(File).to receive(:readlines).with('/etc/facter/facts.d/foo.txt').and_return(['foo=1+1=2'])
26 it 'returns successfully' do
27 expect(Facter.fact(:foo).value).to eq('1+1=2')