@@ -55,23 +55,23 @@ def self.instances
55
55
end
56
56
end
57
57
58
- context 'with no home directory specified' do
59
- it 'does not accept true' do
60
- expect {
58
+ if Puppet . version . start_with? ( '6' )
59
+ context 'with no home directory specified' do
60
+ before ( :each ) do
61
+ Dir . stubs ( :home ) . with ( 'a' ) . returns ( '/home/a' )
62
+ end
63
+
64
+ it 'does accept true' do
61
65
described_class . new ( name : 'a' , purge_ssh_keys : true )
62
- } . to raise_error ( Puppet ::Error , %r{purge_ssh_keys can only be true for users with a defined home directory} )
63
- end
66
+ end
64
67
65
- it 'does not accept the ~ wildcard' do
66
- expect {
68
+ it 'does accept the ~ wildcard' do
67
69
described_class . new ( name : 'a' , purge_ssh_keys : '~/keys' )
68
- } . to raise_error ( Puppet ::Error , %r{meta character ~ or %h only allowed for users with a defined home directory} )
69
- end
70
+ end
70
71
71
- it 'does not accept the %h wildcard' do
72
- expect {
72
+ it 'does accept the %h wildcard' do
73
73
described_class . new ( name : 'a' , purge_ssh_keys : '%h/keys' )
74
- } . to raise_error ( Puppet :: Error , %r{meta character ~ or %h only allowed for users with a defined home directory} )
74
+ end
75
75
end
76
76
end
77
77
@@ -82,6 +82,10 @@ def self.instances
82
82
res
83
83
end
84
84
85
+ before ( :each ) do
86
+ Dir . stubs ( :home ) . with ( 'test' ) . returns ( '/home/test' )
87
+ end
88
+
85
89
let ( :paths ) do
86
90
[ '/dev/null' , '/tmp/keyfile' ] . map { |path | File . expand_path ( path ) }
87
91
end
@@ -106,6 +110,10 @@ def self.instances
106
110
res
107
111
end
108
112
113
+ before ( :each ) do
114
+ Dir . stubs ( :home ) . with ( 'test_user_name' ) . returns ( '/home/test_user_name' )
115
+ end
116
+
109
117
context 'when purging is disabled' do
110
118
let ( :purge_param ) { false }
111
119
0 commit comments