@@ -30,22 +30,22 @@ def modifycmd(param, value)
30
30
# These are values getpwent might give you
31
31
let :users do
32
32
[
33
- Struct ::Passwd . new ( 'root' , 'x' , 0 , 0 ) ,
34
- Struct ::Passwd . new ( 'foo' , 'x' , 1000 , 2000 ) ,
33
+ Etc ::Passwd . new ( 'root' , 'x' , 0 , 0 ) ,
34
+ Etc ::Passwd . new ( 'foo' , 'x' , 1000 , 2000 ) ,
35
35
nil
36
36
]
37
37
end
38
38
39
39
# These are values getgrent might give you
40
40
let :groups do
41
41
[
42
- Struct ::Group . new ( 'root' , 'x' , 0 , %w{ root } ) ,
43
- Struct ::Group . new ( 'bin' , 'x' , 1 , %w{ root bin daemon } ) ,
42
+ Etc ::Group . new ( 'root' , 'x' , 0 , %w{ root } ) ,
43
+ Etc ::Group . new ( 'bin' , 'x' , 1 , %w{ root bin daemon } ) ,
44
44
nil
45
45
]
46
46
end
47
47
48
- # A fake struct besides Struct ::Group and Struct ::Passwd
48
+ # A fake struct besides Etc ::Group and Etc ::Passwd
49
49
let :fakestruct do
50
50
Struct . new ( :foo , :bar )
51
51
end
@@ -82,22 +82,22 @@ def modifycmd(param, value)
82
82
83
83
let ( :utf_8_mixed_users ) {
84
84
[
85
- Struct ::Passwd . new ( 'root' , 'x' , 0 , 0 ) ,
86
- Struct ::Passwd . new ( 'foo' , 'x' , 1000 , 2000 ) ,
87
- Struct ::Passwd . new ( utf_8_jose , utf_8_jose , 1001 , 2000 ) , # UTF-8 character
85
+ Etc ::Passwd . new ( 'root' , 'x' , 0 , 0 ) ,
86
+ Etc ::Passwd . new ( 'foo' , 'x' , 1000 , 2000 ) ,
87
+ Etc ::Passwd . new ( utf_8_jose , utf_8_jose , 1001 , 2000 ) , # UTF-8 character
88
88
# In a UTF-8 environment, ruby will return strings labeled as UTF-8 even if they're not valid in UTF-8
89
- Struct ::Passwd . new ( invalid_utf_8_jose , invalid_utf_8_jose , 1002 , 2000 ) ,
89
+ Etc ::Passwd . new ( invalid_utf_8_jose , invalid_utf_8_jose , 1002 , 2000 ) ,
90
90
nil
91
91
]
92
92
}
93
93
94
94
let ( :latin_1_mixed_users ) {
95
95
[
96
96
# In a LATIN-1 environment, ruby will return *all* strings labeled as LATIN-1
97
- Struct ::Passwd . new ( 'root' . force_encoding ( Encoding ::ISO_8859_1 ) , 'x' , 0 , 0 ) ,
98
- Struct ::Passwd . new ( 'foo' . force_encoding ( Encoding ::ISO_8859_1 ) , 'x' , 1000 , 2000 ) ,
99
- Struct ::Passwd . new ( utf_8_labeled_as_latin_1_jose , utf_8_labeled_as_latin_1_jose , 1002 , 2000 ) ,
100
- Struct ::Passwd . new ( valid_latin1_jose , valid_latin1_jose , 1001 , 2000 ) , # UTF-8 character
97
+ Etc ::Passwd . new ( 'root' . force_encoding ( Encoding ::ISO_8859_1 ) , 'x' , 0 , 0 ) ,
98
+ Etc ::Passwd . new ( 'foo' . force_encoding ( Encoding ::ISO_8859_1 ) , 'x' , 1000 , 2000 ) ,
99
+ Etc ::Passwd . new ( utf_8_labeled_as_latin_1_jose , utf_8_labeled_as_latin_1_jose , 1002 , 2000 ) ,
100
+ Etc ::Passwd . new ( valid_latin1_jose , valid_latin1_jose , 1001 , 2000 ) , # UTF-8 character
101
101
nil
102
102
]
103
103
}
@@ -197,7 +197,7 @@ def modifycmd(param, value)
197
197
end
198
198
199
199
it "should pass the Puppet::Etc :canonical_name Struct member to the constructor" do
200
- users = [ Struct ::Passwd . new ( invalid_utf_8_jose , invalid_utf_8_jose , 1002 , 2000 ) , nil ]
200
+ users = [ Etc ::Passwd . new ( invalid_utf_8_jose , invalid_utf_8_jose , 1002 , 2000 ) , nil ]
201
201
allow ( Etc ) . to receive ( :getpwent ) . and_return ( *users )
202
202
expect ( provider . class ) . to receive ( :new ) . with ( { :name => escaped_utf_8_jose , :canonical_name => invalid_utf_8_jose , :ensure => :present } )
203
203
provider . class . instances
0 commit comments