X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=spec%2Funit%2Ffacter%2Fapt_reboot_required_spec.rb;h=356f36b14de41d65a97f665a2ac0163ae97e30ad;hb=17b9a4481378fb50b5c3745824ae07ddbdd8e3fa;hp=ab3490a20ff723cf010c03c557cbdc9d50df0807;hpb=fe9741fe1d3c7a863314c8e2d9700e9169b22537;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..356f36b 100644 --- a/spec/unit/facter/apt_reboot_required_spec.rb +++ b/spec/unit/facter/apt_reboot_required_spec.rb @@ -2,22 +2,24 @@ require 'spec_helper' describe 'apt_reboot_required fact' do subject { Facter.fact(:apt_reboot_required).value } + after(:each) { Facter.clear } describe 'if a reboot is required' do - before { - Facter.fact(:osfamily).stubs(:value).returns 'Debian' + before(:each) do + Facter.fact(:osfamily).expects(:value).at_least(1).returns 'Debian' File.stubs(:file?).returns true - } - it { expect(Facter.fact(:apt_reboot_required).value).to eq true } + File.expects(:file?).at_least(1).with('/var/run/reboot-required').returns true + end + 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 - } - it { expect(Facter.fact(:apt_reboot_required).value).to eq false } + before(:each) do + 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 + end + it { is_expected.to eq false } end - end