Commit 1c81250 Joshua Hoblitt
committed
1 parent 187c3f0 commit 1c81250 Copy full SHA for 1c81250
File tree 4 files changed +79
-0
lines changed
4 files changed +79
-0
lines changed Original file line number Diff line number Diff line change 6
6
class pureftpd::install (
7
7
$use_selinux = false ,
8
8
) inherits pureftpd::params {
9
+ validate_bool($use_selinux )
9
10
10
11
if ($use_selinux ) {
11
12
$package_name = $pureftpd::params::package_name_selinux
Original file line number Diff line number Diff line change
1
+ require 'spec_helper'
2
+
3
+ describe 'pureftpd::install' , :type => :class do
4
+ describe 'for osfamily RedHat' do
5
+ let ( :facts ) { { :osfamily => 'RedHat' } }
6
+
7
+ describe 'no params' do
8
+ it { should include_class ( 'pureftpd::install' ) }
9
+ it { should contain_package ( 'pure-ftpd' ) . with_ensure ( 'present' ) }
10
+ it { should_not contain_package ( 'pure-ftpd-selinux' ) . with_ensure ( 'present' ) }
11
+ end
12
+
13
+ describe 'use_selinux = false' do
14
+ let ( :params ) { { :use_selinux => false } }
15
+
16
+ it { should include_class ( 'pureftpd::install' ) }
17
+ it { should contain_package ( 'pure-ftpd' ) . with_ensure ( 'present' ) }
18
+ it { should_not contain_package ( 'pure-ftpd-selinux' ) . with_ensure ( 'present' ) }
19
+ end
20
+
21
+ describe 'use_selinux = true' do
22
+ let ( :params ) { { :use_selinux => true } }
23
+
24
+ it { should include_class ( 'pureftpd::install' ) }
25
+ it { should contain_package ( 'pure-ftpd' ) . with_ensure ( 'present' ) }
26
+ it { should contain_package ( 'pure-ftpd-selinux' ) . with_ensure ( 'present' ) }
27
+ end
28
+
29
+ describe 'use_selinux = foo' do
30
+ let ( :params ) { { :use_selinux => 'foo' } }
31
+
32
+ it 'should fail' do
33
+ expect { should include_class ( 'pureftpd::install' ) } .
34
+ to raise_error ( Puppet ::Error , /not a boolean/ )
35
+ end
36
+ end
37
+ end
38
+
39
+ end
Original file line number Diff line number Diff line change
1
+ require 'spec_helper'
2
+
3
+ describe 'pureftpd::params' , :type => :class do
4
+ describe 'for osfamily RedHat' do
5
+ let ( :facts ) { { :osfamily => 'RedHat' } }
6
+
7
+ it { should include_class ( 'pureftpd::params' ) }
8
+ end
9
+
10
+ describe 'unsupported osfamily' do
11
+ let :facts do
12
+ {
13
+ :osfamily => 'Debian' ,
14
+ :operatingsystem => 'Debian' ,
15
+ }
16
+ end
17
+
18
+ it 'should fail' do
19
+ expect { should include_class ( 'pureftpd::params' ) } .
20
+ to raise_error ( Puppet ::Error , /not supported on Debian/ )
21
+ end
22
+ end
23
+
24
+ end
Original file line number Diff line number Diff line change
1
+ require 'spec_helper'
2
+
3
+ describe 'pureftpd::service' , :type => :class do
4
+ let ( :facts ) { { :osfamily => 'RedHat' } }
5
+
6
+ it do
7
+ should contain_service ( 'pure-ftpd' ) . with ( {
8
+ :hasstatus => 'true' ,
9
+ :hasrestart => 'true' ,
10
+ :enable => 'true' ,
11
+ } )
12
+ end
13
+
14
+ end
15
+
You can’t perform that action at this time.
0 commit comments