111
111
type : 'Optional[String]' ,
112
112
desc : 'a optional string value' ,
113
113
} ,
114
+ test_array : {
115
+ type : 'Array' ,
116
+ desc : 'an array value' ,
117
+ } ,
114
118
} ,
115
119
autorequire : {
116
120
var : '$test_string' ,
122
126
list : %w[ foo bar ] ,
123
127
} ,
124
128
autonotify : {
125
- mixed : [ 10 , '$test_integer' ] ,
129
+ mixed : [ 10 , '$test_integer' , '$test_optional_string' , '$test_array' ] ,
126
130
} ,
127
131
}
128
132
end
@@ -145,7 +149,7 @@ def extract_values(function)
145
149
# rely on the fact that the resource api is doing `self[]` internally to find the value
146
150
# see https://github.com/puppetlabs/puppet/blob/9f2c143962803a72c68f35be3462944e851bcdce/lib/puppet/type.rb#L2143
147
151
# for details
148
- result += { test_string : 'foo' , test_integer : 100 } . instance_eval ( &values )
152
+ result += { test_string : 'foo' , test_integer : 100 , test_array : %w[ a b c ] } . instance_eval ( &values )
149
153
end
150
154
result
151
155
end
@@ -173,8 +177,8 @@ def extract_values(function)
173
177
174
178
describe 'autonotify' do
175
179
it ( 'yields the block for `mixed`' ) { expect { |b | type . eachautonotify ( &b ) } . to yield_with_args ( :mixed , be_a ( Proc ) ) }
176
- it ( 'the yielded block returns multiple integer values' ) do
177
- expect ( extract_values ( :eachautonotify ) ) . to eq [ 10 , 100 ]
180
+ it ( 'the yielded block returns multiple integer values, the flattened array results, and no nils ' ) do
181
+ expect ( extract_values ( :eachautonotify ) ) . to eq [ 10 , 100 , 'a' , 'b' , 'c' ]
178
182
end
179
183
end
180
184
end
0 commit comments