Update stdlib and concat to 6.1.0 both
[mirror/dsa-puppet.git] / 3rdparty / modules / stdlib / spec / functions / os_version_gte_spec.rb
1 require 'spec_helper'
2
3 describe 'os_version_gte' do
4   context 'on Debian 9' do
5     let(:facts) do
6       {
7         :operatingsystem => 'Debian',
8         :operatingsystemmajrelease => '9',
9       }
10     end
11
12     it { is_expected.to run.with_params('Debian', '9').and_return(true) }
13     it { is_expected.to run.with_params('Debian', '8').and_return(false) }
14     it { is_expected.to run.with_params('Debian', '8.0').and_return(false) }
15     it { is_expected.to run.with_params('Ubuntu', '16.04').and_return(false) }
16     it { is_expected.to run.with_params('Fedora', '29').and_return(false) }
17   end
18
19   context 'on Ubuntu 16.04' do
20     let(:facts) do
21       {
22         :operatingsystem => 'Ubuntu',
23         :operatingsystemmajrelease => '16.04',
24       }
25     end
26
27     it { is_expected.to run.with_params('Debian', '9').and_return(false) }
28     it { is_expected.to run.with_params('Ubuntu', '16').and_return(false) }
29     it { is_expected.to run.with_params('Ubuntu', '16.04').and_return(true) }
30     it { is_expected.to run.with_params('Ubuntu', '18.04').and_return(true) }
31     it { is_expected.to run.with_params('Fedora', '29').and_return(false) }
32   end
33
34   context 'with invalid params' do
35     let(:facts) do
36       {
37         :operatingsystem => 'Ubuntu',
38         :operatingsystemmajrelease => '16.04',
39       }
40     end
41
42     it { is_expected.to run.with_params('123', 'abc').and_return(false) }
43     it { is_expected.to run.with_params([], 123).and_raise_error(ArgumentError) }
44   end
45 end