Add the FrozenStrings magic comment
[puppet-modules/puppetlabs-apt.git] / spec / unit / facter / apt_update_last_success_spec.rb
1 # frozen_string_literal: true
2
3 require 'spec_helper'
4
5 describe 'apt_update_last_success fact' do
6   subject { Facter.fact(:apt_update_last_success).value }
7
8   before(:each) { Facter.clear }
9
10   describe 'on Debian based distro which has not yet created the update-success-stamp file' do
11     it 'has a value of -1' do
12       allow(Facter.fact(:osfamily)).to receive(:value).and_return('Debian')
13       allow(File).to receive(:exist?).with('/var/lib/apt/periodic/update-success-stamp').and_return(false)
14       is_expected.to eq(-1)
15     end
16   end
17
18   describe 'on Debian based distro which has created the update-success-stamp' do
19     it 'has the value of the mtime of the file' do
20       allow(Facter.fact(:osfamily)).to receive(:value).and_return('Debian')
21       allow(File).to receive(:exist?).and_return(true)
22       allow(File).to receive(:mtime).and_return(1_407_660_561)
23       is_expected.to eq(1_407_660_561)
24     end
25   end
26 end