module-puppetlabs-apt/spec/unit/facter/apt_update_last_success_spec.rb
Morgan Haskel 1139f801eb Convert specs to RSpec 3.1.7 syntax with Transpec
This conversion is done by Transpec 3.0.8 with the following command:
    transpec spec/classes spec/defines spec/unit

* 87 conversions
    from: it { should ... }
      to: it { is_expected.to ... }

* 14 conversions
    from: obj.should
      to: expect(obj).to

* 7 conversions
    from: == expected
      to: eq(expected)

* 1 conversion
    from: it { should_not ... }
      to: it { is_expected.not_to ... }

For more details: https://github.com/yujinakayama/transpec#supported-conversions
2015-02-24 13:20:29 -08:00

28 lines
812 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
is_expected.to eq(-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
is_expected.to eq(1407660561)
end
end
end