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.
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