Add the FrozenStrings magic comment
[puppet-modules/puppetlabs-apt.git] / spec / unit / facter / apt_reboot_required_spec.rb
index 356f36b14de41d65a97f665a2ac0163ae97e30ad..7621872d0890b776d12afbe903938e60b82f2945 100644 (file)
@@ -1,24 +1,26 @@
+# 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(: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 true
+      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(: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
+      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