1 # frozen_string_literal: true
5 describe 'apt_update_last_success fact' do
6 subject { Facter.fact(:apt_update_last_success).value }
8 before(:each) { Facter.clear }
10 describe 'on Debian based distro which has not yet created the update-success-stamp file' do
11 it 'has a value of -1' do
12 allow(Facter.fact(:osfamily)).to receive(:value).and_return('Debian')
13 allow(File).to receive(:exist?).with('/var/lib/apt/periodic/update-success-stamp').and_return(false)
18 describe 'on Debian based distro which has created the update-success-stamp' do
19 it 'has the value of the mtime of the file' do
20 allow(Facter.fact(:osfamily)).to receive(:value).and_return('Debian')
21 allow(File).to receive(:exist?).and_return(true)
22 allow(File).to receive(:mtime).and_return(1_407_660_561)
23 is_expected.to eq(1_407_660_561)