Skip to content

Commit

Permalink
Merge pull request #1155 from tphoney/IAC-1375
Browse files Browse the repository at this point in the history
(IAC-1375) fix unit tests for pe_version fact, when using later facte…
  • Loading branch information
DavidS authored Jan 13, 2021
2 parents 452d745 + ee070b5 commit 85ed980
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion spec/unit/facter/pe_version_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
require 'spec_helper'

describe 'PE Version specs' do
# we mock calls for the puppetversion fact, it is not normal to expect nil responses when mocking.
RSpec::Mocks.configuration.allow_message_expectations_on_nil = true
context 'when puppetversion is nil' do
before :each do
allow(Facter.fact(:puppetversion)).to receive(:value).and_return(nil)
Expand All @@ -20,7 +22,8 @@
puppetversion = "2.7.19 (Puppet Enterprise #{version})"
context "puppetversion => #{puppetversion}" do
before :each do
allow(Facter.fact(:puppetversion)).to receive(:value).and_return(puppetversion)
allow(Facter).to receive(:value).with(anything).and_call_original
allow(Facter).to receive(:value).with('puppetversion').and_return(puppetversion)
end

(major, minor, patch) = version.split('.')
Expand Down

0 comments on commit 85ed980

Please sign in to comment.