Add missing new files from commit 131e09855e06
[mirror/dsa-puppet.git] / 3rdparty / modules / stdlib / spec / functions / os_version_gte_spec.rb
diff --git a/3rdparty/modules/stdlib/spec/functions/os_version_gte_spec.rb b/3rdparty/modules/stdlib/spec/functions/os_version_gte_spec.rb
new file mode 100644 (file)
index 0000000..4abfd7e
--- /dev/null
@@ -0,0 +1,33 @@
+require 'spec_helper'
+
+describe 'os_version_gte' do
+  context 'on Debian 9' do
+    let(:facts) do
+      {
+        :operatingsystem => 'Debian',
+        :operatingsystemmajrelease => '9',
+      }
+    end
+
+    it { is_expected.to run.with_params('Debian', '9').and_return(true) }
+    it { is_expected.to run.with_params('Debian', '8').and_return(false) }
+    it { is_expected.to run.with_params('Debian', '8.0').and_return(false) }
+    it { is_expected.to run.with_params('Ubuntu', '16.04').and_return(false) }
+    it { is_expected.to run.with_params('Fedora', '29').and_return(false) }
+  end
+
+  context 'on Ubuntu 16.04' do
+    let(:facts) do
+      {
+        :operatingsystem => 'Ubuntu',
+        :operatingsystemmajrelease => '16.04',
+      }
+    end
+
+    it { is_expected.to run.with_params('Debian', '9').and_return(false) }
+    it { is_expected.to run.with_params('Ubuntu', '16').and_return(false) }
+    it { is_expected.to run.with_params('Ubuntu', '16.04').and_return(true) }
+    it { is_expected.to run.with_params('Ubuntu', '18.04').and_return(true) }
+    it { is_expected.to run.with_params('Fedora', '29').and_return(false) }
+  end
+end