Cleanup via rubocop of ruby code
[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
6   before(:each) { Facter.clear }
7   after(:each) { Facter.clear }
8
9   describe 'on Debian based distro which has not yet created the update-success-stamp file' do
10     it 'has a value of -1' do
11       Facter.fact(:osfamily).stubs(:value).returns 'Debian'
12       File.expects(:exist?).with('/var/lib/apt/periodic/update-success-stamp').returns false
13       is_expected.to eq(-1)
14     end
15   end
16
17   describe 'on Debian based distro which has created the update-success-stamp' do
18     it 'has the value of the mtime of the file' do
19       Facter.fact(:osfamily).stubs(:value).returns 'Debian'
20       File.stubs(:exist?).returns true
21       File.stubs(:mtime).returns 1_407_660_561
22       is_expected.to eq(1_407_660_561)
23     end
24   end
25 end