14bc3ab3bd35a706ed2b84d742bbfcf2d4e7626f
[puppet-modules/puppetlabs-apt.git] / spec / unit / facter / apt_update_last_success_spec.rb
1 require 'spec_helper'
2
3 describe 'apt_update_last_success fact' do
4   subject { Facter.fact(:apt_update_last_success).value }
5   after(:each) { Facter.clear }
6
7   describe 'on Debian based distro which has not yet created the update-success-stamp file' do
8     it 'should have a value of -1' do
9       Facter.fact(:osfamily).stubs(:value).returns 'Debian'
10       File.stubs(:exists?).returns false
11       is_expected.to eq(-1)
12     end
13   end
14
15   describe 'on Debian based distro which has created the update-success-stamp' do
16     it 'should have the value of the mtime of the file' do
17       Facter.fact(:osfamily).stubs(:value).returns 'Debian'
18       File.stubs(:exists?).returns true
19       File.stubs(:mtime).returns 1407660561
20       is_expected.to eq(1407660561)
21     end
22   end
23
24 end