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)
17 it { is_expected.to eq true }
20 describe 'if a reboot is not required' do
22 allow(Facter.fact(:osfamily)).to receive(:value).and_return('Debian')
23 allow(File).to receive(:file?).and_return(true)
24 allow(File).to receive(:file?).once.with('/var/run/reboot-required').and_return(false)
27 it { is_expected.to eq false }