(maint) Stub fact exists call with argument passed
authorHunter Haugen <hunter@puppet.com>
Wed, 12 Apr 2017 18:19:32 +0000 (11:19 -0700)
committerHunter Haugen <hunter@puppet.com>
Wed, 12 Apr 2017 18:25:49 +0000 (11:25 -0700)
I can't replicate what's going on, but I wonder if the stub is being
bypassed and the actual underlying debian filesystem is being hit. The
timestamps returned by the unit test are from just before the unit test
ran.

spec/unit/facter/apt_update_last_success_spec.rb

index 14bc3ab3bd35a706ed2b84d742bbfcf2d4e7626f..4de608d7dbc4117b98d570805fac40868b595882 100644 (file)
@@ -7,7 +7,7 @@ describe 'apt_update_last_success fact' do
   describe 'on Debian based distro which has not yet created the update-success-stamp file' do
     it 'should have a value of -1' do
       Facter.fact(:osfamily).stubs(:value).returns 'Debian'
-      File.stubs(:exists?).returns false
+      File.expects(:exists?).with('/var/lib/apt/periodic/update-success-stamp').returns false
       is_expected.to eq(-1)
     end
   end