(CONT-773) Rubocop Unsafe Auto Fixes 1-3
[puppet-modules/puppetlabs-apt.git] / spec / unit / facter / apt_reboot_required_spec.rb
1 # frozen_string_literal: true
2
3 require 'spec_helper'
4
5 describe 'apt_reboot_required fact' do
6   subject { Facter.fact(:apt_reboot_required).value }
7
8   before(:each) { Facter.clear }
9
10   describe 'if a reboot is required' do
11     before(:each) 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)
15     end
16
17     it { is_expected.to be true }
18   end
19
20   describe 'if a reboot is not required' do
21     before(:each) 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)
25     end
26
27     it { is_expected.to be false }
28   end
29 end