apt_update_last_success_spec.rb 812 B

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