Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(IAC-1375) fix unit tests for pe_version fact, when using later facte… #1155

Merged
merged 1 commit into from
Jan 13, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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