This repository was archived by the owner on Jun 19, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
spec/framework/core/fact_loaders Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change 210
210
expect ( internal_fact_loader . legacy_facts . first . name ) . to eq ( 'operatingsystem' )
211
211
end
212
212
end
213
+
214
+ context 'when loading wildcard facts' do
215
+ before do
216
+ allow ( os_detector_mock ) . to receive ( :hierarchy ) . and_return ( [ :Windows ] )
217
+ allow ( OsDetector ) . to receive ( :instance ) . and_return ( os_detector_mock )
218
+
219
+ class_discoverer_mock = instance_spy ( Facter ::ClassDiscoverer )
220
+ allow ( class_discoverer_mock )
221
+ . to receive ( :discover_classes )
222
+ . with ( :Windows )
223
+ . and_return ( [ Facts ::Windows ::NetworkInterfaces ] )
224
+ allow ( Facter ::ClassDiscoverer ) . to receive ( :instance ) . and_return ( class_discoverer_mock )
225
+
226
+ stub_const ( 'Facts::Windows::NetworkInterfaces::FACT_NAME' , 'network_.*' )
227
+ end
228
+
229
+ it 'loads one fact' do
230
+ internal_fact_loader = Facter ::InternalFactLoader . new
231
+
232
+ expect ( internal_fact_loader . facts . size ) . to eq ( 1 )
233
+ end
234
+
235
+ it 'loads one legacy fact' do
236
+ internal_fact_loader = Facter ::InternalFactLoader . new
237
+
238
+ expect ( internal_fact_loader . legacy_facts . size ) . to eq ( 1 )
239
+ end
240
+
241
+ it 'loads no core facts' do
242
+ internal_fact_loader = Facter ::InternalFactLoader . new
243
+
244
+ expect ( internal_fact_loader . core_facts ) . to be_empty
245
+ end
246
+ end
213
247
end
214
248
end
You can’t perform that action at this time.
0 commit comments