X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=spec%2Funit%2Ffacter%2Fapt_reboot_required_spec.rb;h=ed6efd075e63ca89313ca060f470bcacc8e9c5cc;hb=a005a1067a3068ee28e555a76b07174a61c86fc5;hp=ab3490a20ff723cf010c03c557cbdc9d50df0807;hpb=23855f199bed69cdd50aff411942c7704a40c824;p=puppet-modules%2Fpuppetlabs-apt.git diff --git a/spec/unit/facter/apt_reboot_required_spec.rb b/spec/unit/facter/apt_reboot_required_spec.rb index ab3490a..ed6efd0 100644 --- a/spec/unit/facter/apt_reboot_required_spec.rb +++ b/spec/unit/facter/apt_reboot_required_spec.rb @@ -6,18 +6,20 @@ describe 'apt_reboot_required fact' do describe 'if a reboot is required' do before { - Facter.fact(:osfamily).stubs(:value).returns 'Debian' + Facter.fact(:osfamily).expects(:value).at_least(1).returns 'Debian' File.stubs(:file?).returns true + File.expects(:file?).at_least(1).with('/var/run/reboot-required').returns true } - it { expect(Facter.fact(:apt_reboot_required).value).to eq true } + it { is_expected.to eq true } end describe 'if a reboot is not required' do before { - Facter.fact(:osfamily).stubs(:value).returns 'Debian' - File.stubs(:file?).returns false + Facter.fact(:osfamily).expects(:value).at_least(1).returns 'Debian' + File.stubs(:file?).returns true + File.expects(:file?).at_least(1).with('/var/run/reboot-required').returns false } - it { expect(Facter.fact(:apt_reboot_required).value).to eq false } + it { is_expected.to eq false } end end