module-puppetlabs-apt/spec/unit/facter/apt_update_last_success_spec.rb
Wolf Noble 7a192d7bea - add bits for updating apt
- fix spec tests to include osfamily fact
- add spec tests to verify current default behavior unimpacted.
- manage the update-stamp file in puppet via content rather than a served file.
- update custom fact to return -1 if the file doesn't exist
- add spec test for custom fact
- refactor to use a variable vs a collector/override
- document parameters a bit more verbosely
- remove empty unconstrained fact
- Add osfamily fact to backports tests to facilitate functional tests on non-debian hosts
2014-09-24 16:29:27 -07:00

28 lines
794 B
Ruby

require 'spec_helper'
describe 'apt_update_last_success fact' do
subject { Facter.fact(:apt_update_last_success).value }
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
end
end
describe 'on Debian based distro which has created the update-success-stamp' do
before {
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
end
end
end