X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=spec%2Funit%2Ffacter%2Fapt_update_last_success_spec.rb;h=ada6aa58947aaf8c2ec4a324071a68dbf346da80;hb=e014fc04ed8358e4f7c2e87f7434df9817a4c7bb;hp=08774cd012eb47bde480ec264970dc999c77656e;hpb=e5338f2e53bb47842576e1a2a4391335777e8271;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 08774cd..ada6aa5 100644 --- a/spec/unit/facter/apt_update_last_success_spec.rb +++ b/spec/unit/facter/apt_update_last_success_spec.rb @@ -2,26 +2,23 @@ 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 - before { - Facter.fact(:osfamily).stubs(:value).returns 'Debian' - File.stubs(:exists?).returns false - } it 'should have a value of -1' do - should == -1 + Facter.fact(:osfamily).stubs(:value).returns 'Debian' + File.expects(:exists?).with('/var/lib/apt/periodic/update-success-stamp').returns false + is_expected.to eq(-1) end end describe 'on Debian based distro which has created the update-success-stamp' do - before { + 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 - } - it 'should have the value of the mtime of the file' do - should == 1407660561 + is_expected.to eq(1407660561) end end