[rspec] extend test for custom facts

This commit is contained in:
varac 2015-12-07 19:44:14 +01:00
parent 5381cb7b61
commit 2c656517bd

View file

@ -21,6 +21,14 @@ describe "Facter::Util::Fact" do
it "debian_codename = wheezy" do it "debian_codename = wheezy" do
expect(Facter.fact(:debian_codename).value).to eq('wheezy') expect(Facter.fact(:debian_codename).value).to eq('wheezy')
end end
it "debian_nextcodename = jessie" do
expect(Facter.fact(:debian_nextcodename).value).to eq('jessie')
end
it "debian_nextrelease = stable" do
expect(Facter.fact(:debian_nextrelease).value).to eq('stable')
end
end end
context 'Debian 8' do context 'Debian 8' do
@ -37,20 +45,31 @@ describe "Facter::Util::Fact" do
it "debian_codename = jessie" do it "debian_codename = jessie" do
expect(Facter.fact(:debian_codename).value).to eq('jessie') expect(Facter.fact(:debian_codename).value).to eq('jessie')
end end
it "debian_nextcodename = stretch" do
expect(Facter.fact(:debian_nextcodename).value).to eq('stretch')
end
it "debian_nextrelease = testing" do
expect(Facter.fact(:debian_nextrelease).value).to eq('testing')
end
end end
context 'Ubuntu 15.10' do context 'Ubuntu 15.10' do
before do before do
Facter.fact(:operatingsystem).stubs(:value).returns("Ubuntu") Facter.fact(:operatingsystem).stubs(:value).returns("Ubuntu")
Facter.fact(:operatingsystemrelease).stubs(:value).returns("15.10") Facter.fact(:operatingsystemrelease).stubs(:value).returns("15.10")
Facter.fact(:lsbdistcodename).stubs(:value).returns("Vivid") Facter.fact(:lsbdistcodename).stubs(:value).returns("wily")
end end
it "ubuntu_codename = Vivid" do it "ubuntu_codename = wily" do
expect(Facter.fact(:ubuntu_codename).value).to eq('Vivid') expect(Facter.fact(:ubuntu_codename).value).to eq('wily')
end
it "ubuntu_nextcodename = xenial" do
expect(Facter.fact(:ubuntu_nextcodename).value).to eq('xenial')
end end
end end
end end
describe "Test 'apt_running' fact" do describe "Test 'apt_running' fact" do