From: Hunter Haugen Date: Wed, 12 Apr 2017 18:19:32 +0000 (-0700) Subject: (maint) Stub fact exists call with argument passed X-Git-Tag: 3.0.0~1 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=ac3e72da3258f8e3396b4aa3cc648cf8d4e38bc2;p=puppet-modules%2Fpuppetlabs-apt.git (maint) Stub fact exists call with argument passed 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. --- diff --git a/spec/unit/facter/apt_update_last_success_spec.rb b/spec/unit/facter/apt_update_last_success_spec.rb index 14bc3ab..4de608d 100644 --- a/spec/unit/facter/apt_update_last_success_spec.rb +++ b/spec/unit/facter/apt_update_last_success_spec.rb @@ -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