1 # frozen_string_literal: true
5 describe 'apt_reboot_required fact' do
6 subject { Facter.fact(:apt_reboot_required).value }
8 before(:each) { Facter.clear }
10 describe 'if a reboot is required' do
12 allow(Facter.fact(:osfamily)).to receive(:value).and_return('Debian')
13 allow(File).to receive(:file?).and_return(true)
14 allow(File).to receive(:file?).once.with('/var/run/reboot-required').and_return(true)
16 it { is_expected.to eq true }
19 describe 'if a reboot is not required' do
21 allow(Facter.fact(:osfamily)).to receive(:value).and_return('Debian')
22 allow(File).to receive(:file?).and_return(true)
23 allow(File).to receive(:file?).once.with('/var/run/reboot-required').and_return(false)
25 it { is_expected.to eq false }