X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=spec%2Funit%2Ffacter%2Fapt_reboot_required_spec.rb;h=7621872d0890b776d12afbe903938e60b82f2945;hb=5403a6eb9197e4da64d0ef7d4d1f91e0e6bf4a3f;hp=ed6efd075e63ca89313ca060f470bcacc8e9c5cc;hpb=7448a7597cb9d89be02fec9aefdb85541dda272e;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 ed6efd0..7621872 100644 --- a/spec/unit/facter/apt_reboot_required_spec.rb +++ b/spec/unit/facter/apt_reboot_required_spec.rb @@ -1,25 +1,27 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apt_reboot_required fact' do subject { Facter.fact(:apt_reboot_required).value } - after(:each) { Facter.clear } + + before(:each) { Facter.clear } describe 'if a reboot is required' do - before { - 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 - } + before(:each) do + allow(Facter.fact(:osfamily)).to receive(:value).and_return('Debian') + allow(File).to receive(:file?).and_return(true) + allow(File).to receive(:file?).once.with('/var/run/reboot-required').and_return(true) + end it { is_expected.to eq true } end describe 'if a reboot is not required' do - before { - 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 - } + before(:each) do + allow(Facter.fact(:osfamily)).to receive(:value).and_return('Debian') + allow(File).to receive(:file?).and_return(true) + allow(File).to receive(:file?).once.with('/var/run/reboot-required').and_return(false) + end it { is_expected.to eq false } end - end