From cc49b0296bb40b57ef953e6d0cdf4e2f51e9efb3 Mon Sep 17 00:00:00 2001 From: "R. Tyler Croy" Date: Mon, 31 Oct 2016 16:18:55 -0700 Subject: [PATCH] Add appropriate RSpec mocks to ensure Factor lookups do what we expect in Jenkins::Plugins This is required since Facter#value is going to ultimately start using the File module to dig through the directory structure on disk looking for facts. With the OpenBSD support this is suddenly a problem as we weren't previously looking up facts within these unit tests See also: --- spec/unit/jenkins_plugins_spec.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/spec/unit/jenkins_plugins_spec.rb b/spec/unit/jenkins_plugins_spec.rb index 6361bc79c..34a9895e8 100644 --- a/spec/unit/jenkins_plugins_spec.rb +++ b/spec/unit/jenkins_plugins_spec.rb @@ -24,7 +24,9 @@ before :each do Puppet::Jenkins.stub(:home_dir).and_return(home) - File.should_receive(:directory?).with(File.join(home, 'plugins')).and_return(dir_exists) + plugin_dir = File.join(home, 'plugins') + expect(File).to receive(:directory).with(plugin_dir).and_return(dir_exists) + expect(Facter).to receive(:value).with(:osfamily).and_return('RedHat').at_least(:once) end context 'and the directory exists' do @@ -33,7 +35,7 @@ end context 'and the directory does not exist' do - it { should be false} + it { should be false } end end end