3 describe 'apt_reboot_required fact' do
4 subject { Facter.fact(:apt_reboot_required).value }
6 after(:each) { Facter.clear }
8 describe 'if a reboot is required' do
10 allow(Facter.fact(:osfamily)).to receive(:value).and_return('Debian')
11 allow(File).to receive(:file?).and_return(true)
12 allow(File).to receive(:file?).once.with('/var/run/reboot-required').and_return(true)
14 it { is_expected.to eq true }
17 describe 'if a reboot is not required' do
19 allow(Facter.fact(:osfamily)).to receive(:value).and_return('Debian')
20 allow(File).to receive(:file?).and_return(true)
21 allow(File).to receive(:file?).once.with('/var/run/reboot-required').and_return(false)
23 it { is_expected.to eq false }