X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=spec%2Funit%2Ffacter%2Fapt_update_last_success_spec.rb;h=c0b028aac9e7d82ddc59a9d2cce764918b19b837;hb=ef0d4e7337a535a25d76b73aebf6bfdda975f533;hp=ada6aa58947aaf8c2ec4a324071a68dbf346da80;hpb=e014fc04ed8358e4f7c2e87f7434df9817a4c7bb;p=puppet-modules%2Fpuppetlabs-apt.git diff --git a/spec/unit/facter/apt_update_last_success_spec.rb b/spec/unit/facter/apt_update_last_success_spec.rb index ada6aa5..c0b028a 100644 --- a/spec/unit/facter/apt_update_last_success_spec.rb +++ b/spec/unit/facter/apt_update_last_success_spec.rb @@ -1,25 +1,26 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apt_update_last_success fact' do subject { Facter.fact(:apt_update_last_success).value } + before(:each) { Facter.clear } - after(:each) { Facter.clear } describe 'on Debian based distro which has not yet created the update-success-stamp file' do - it 'should have a value of -1' do - Facter.fact(:osfamily).stubs(:value).returns 'Debian' - File.expects(:exists?).with('/var/lib/apt/periodic/update-success-stamp').returns false + it 'has a value of -1' do + allow(Facter.fact(:osfamily)).to receive(:value).and_return('Debian') + allow(File).to receive(:exist?).with('/var/lib/apt/periodic/update-success-stamp').and_return(false) is_expected.to eq(-1) end end describe 'on Debian based distro which has created the update-success-stamp' do - it 'should have the value of the mtime of the file' do - Facter.fact(:osfamily).stubs(:value).returns 'Debian' - File.stubs(:exists?).returns true - File.stubs(:mtime).returns 1407660561 - is_expected.to eq(1407660561) + it 'has the value of the mtime of the file' do + allow(Facter.fact(:osfamily)).to receive(:value).and_return('Debian') + allow(File).to receive(:exist?).and_return(true) + allow(File).to receive(:mtime).and_return(1_407_660_561) + is_expected.to eq(1_407_660_561) end end - end