apt_package_updates_spec.rb 837 B

1234567891011121314151617181920212223242526272829
  1. require 'spec_helper'
  2. describe 'apt_package_updates fact' do
  3. subject { Facter.fact(:apt_package_updates).value }
  4. after(:each) { Facter.clear }
  5. describe 'on Debian based distro missing update-notifier-common' do
  6. before {
  7. Facter.fact(:osfamily).stubs(:value).returns 'Debian'
  8. File.stubs(:executable?).returns false
  9. }
  10. it { should == nil }
  11. end
  12. describe 'on Debian based distro' do
  13. before {
  14. Facter.fact(:osfamily).stubs(:value).returns 'Debian'
  15. File.stubs(:executable?).returns true
  16. Facter::Util::Resolution.stubs(:exec).returns "puppet-common\nlinux-generic\nlinux-image-generic"
  17. }
  18. it {
  19. if Facter.version < '2.0.0'
  20. should == 'puppet-common,linux-generic,linux-image-generic'
  21. else
  22. should == ['puppet-common', 'linux-generic', 'linux-image-generic']
  23. end
  24. }
  25. end
  26. end