]> gitweb.fluxo.info Git - puppet-ferm.git/commitdiff
enhance spec coverage
authorTim Meusel <tim@bastelfreak.de>
Mon, 28 Jun 2021 09:50:34 +0000 (11:50 +0200)
committerTim Meusel <tim@bastelfreak.de>
Mon, 28 Jun 2021 11:33:40 +0000 (13:33 +0200)
.fixtures.yml
spec/classes/ferm_spec.rb

index f2243e6ddf654e18e0d33099518ad975d669ac54..9e0b18810501c2fedc5bbee117b2000e9c7823f0 100644 (file)
@@ -3,3 +3,4 @@ fixtures:
   repositories:
     stdlib: 'https://github.com/puppetlabs/puppetlabs-stdlib'
     concat: 'https://github.com/puppetlabs/puppetlabs-concat'
+    vcsrepo: 'https://github.com/puppetlabs/puppetlabs-vcsrepo'
index b1343685db6ddb2ecdf1b6f2e1ea937d7e3d4a6f..4ae75eb3e2fe07ef2b8456002ac3d656ef4457b3 100644 (file)
@@ -16,7 +16,7 @@ describe 'ferm' do
         it { is_expected.to contain_class('ferm::config') }
         it { is_expected.to contain_class('ferm::service') }
         it { is_expected.to contain_class('ferm::install') }
-        it { is_expected.to contain_package('ferm') }
+        it { is_expected.to contain_package('ferm').with_ensure('latest') }
         if facts[:os]['name'] == 'Debian'
           it { is_expected.to contain_file('/etc/ferm/ferm.d') }
           it { is_expected.to contain_file('/etc/ferm/ferm.d/definitions') }
@@ -158,7 +158,6 @@ describe 'ferm' do
         it { is_expected.to contain_ferm__chain('OUTPUT') }
         it { is_expected.to contain_ferm__chain('INPUT') }
       end
-
       context 'it preserves chains' do
         let :params do
           {
@@ -181,6 +180,20 @@ describe 'ferm' do
             with_content(%r{chain POSTROUTING @preserve;})
         end
       end
+      context 'it works with git clone' do
+        let :params do
+          {
+            install_method: 'vcsrepo',
+          }
+        end
+
+        it { is_expected.to compile.with_all_deps }
+        it { is_expected.to contain_package('git').with_ensure('present') }
+        it { is_expected.to contain_package('iptables').with_ensure('present') }
+        it { is_expected.to contain_package('perl').with_ensure('present') }
+        it { is_expected.to contain_package('make').with_ensure('present') }
+        it { is_expected.to contain_package('ferm').with_ensure('absent') }
+      end
     end
   end
 end