14
14
end
15
15
16
16
let ( :technet ) do
17
- MicrosoftPatch ::SiteInfo ::TECHNET
17
+ MicrosoftPatchFinder ::SiteInfo ::TECHNET
18
18
end
19
19
20
20
let ( :microsoft ) do
21
- MicrosoftPatch ::SiteInfo ::MICROSOFT
21
+ MicrosoftPatchFinder ::SiteInfo ::MICROSOFT
22
22
end
23
23
24
24
let ( :googleapis ) do
25
- MicrosoftPatch ::SiteInfo ::GOOGLEAPIS
25
+ MicrosoftPatchFinder ::SiteInfo ::GOOGLEAPIS
26
26
end
27
27
28
- describe MicrosoftPatch ::SiteInfo do
28
+ describe MicrosoftPatchFinder ::SiteInfo do
29
29
context 'Constants' do
30
30
context 'TECHNET' do
31
31
it 'returns 157.56.148.23 as the IP' do
59
59
end
60
60
end
61
61
62
- describe MicrosoftPatch :: Base do
62
+ describe MicrosoftPatchFinder :: Helper do
63
63
64
64
def get_stdout ( &block )
65
65
out = $stdout
@@ -84,7 +84,9 @@ def get_stderr(&block)
84
84
end
85
85
86
86
subject do
87
- MicrosoftPatch ::Base . new
87
+ mod = Object . new
88
+ mod . extend MicrosoftPatchFinder ::Helper
89
+ mod
88
90
end
89
91
90
92
describe '#print_debug' do
@@ -119,14 +121,14 @@ def get_stderr(&block)
119
121
describe '#send_http_request' do
120
122
it 'returns a Rex::Proto::Http::Response object' do
121
123
allow ( subject ) . to receive ( :print_debug )
122
- res = subject . send_http_request ( MicrosoftPatch ::SiteInfo ::TECHNET )
124
+ res = subject . send_http_request ( MicrosoftPatchFinder ::SiteInfo ::TECHNET )
123
125
expect ( res ) . to be_kind_of ( Rex ::Proto ::Http ::Response )
124
126
end
125
127
end
126
128
127
129
end
128
130
129
- describe MicrosoftPatch ::PatchLinkCollector do
131
+ describe MicrosoftPatchFinder ::PatchLinkCollector do
130
132
131
133
let ( :ms15_100_html ) do
132
134
%Q|
@@ -199,7 +201,7 @@ def get_stderr(&block)
199
201
end
200
202
201
203
subject do
202
- MicrosoftPatch ::PatchLinkCollector . new
204
+ MicrosoftPatchFinder ::PatchLinkCollector . new
203
205
end
204
206
205
207
before ( :each ) do
@@ -361,15 +363,15 @@ def get_stderr(&block)
361
363
362
364
end
363
365
364
- describe MicrosoftPatch ::TechnetMsbSearch do
366
+ describe MicrosoftPatchFinder ::TechnetMsbSearch do
365
367
366
368
subject do
367
- MicrosoftPatch ::TechnetMsbSearch . new
369
+ MicrosoftPatchFinder ::TechnetMsbSearch . new
368
370
end
369
371
370
372
before ( :each ) do
371
- allow_any_instance_of ( MicrosoftPatch :: Base ) . to receive ( :print_debug )
372
- allow_any_instance_of ( MicrosoftPatch :: Base ) . to receive ( :send_http_request ) { |info_obj , info_opts , opts |
373
+ allow_any_instance_of ( MicrosoftPatchFinder :: TechnetMsbSearch ) . to receive ( :print_debug )
374
+ allow_any_instance_of ( MicrosoftPatchFinder :: TechnetMsbSearch ) . to receive ( :send_http_request ) { |info_obj , info_opts , opts |
373
375
case opts [ 'uri' ]
374
376
when /\/ en\- us\/ security\/ bulletin\/ dn602597\. aspx/
375
377
html = %Q|
@@ -465,10 +467,10 @@ def get_stderr(&block)
465
467
466
468
end
467
469
468
- describe MicrosoftPatch ::GoogleMsbSearch do
470
+ describe MicrosoftPatchFinder ::GoogleMsbSearch do
469
471
470
472
subject do
471
- MicrosoftPatch ::GoogleMsbSearch . new
473
+ MicrosoftPatchFinder ::GoogleMsbSearch . new
472
474
end
473
475
474
476
let ( :json_data ) do
@@ -555,8 +557,8 @@ def get_stderr(&block)
555
557
end
556
558
557
559
before ( :each ) do
558
- allow_any_instance_of ( MicrosoftPatch :: Base ) . to receive ( :print_debug )
559
- allow_any_instance_of ( MicrosoftPatch :: Base ) . to receive ( :send_http_request ) { |info_obj , info_opts , opts |
560
+ allow_any_instance_of ( MicrosoftPatchFinder :: GoogleMsbSearch ) . to receive ( :print_debug )
561
+ allow_any_instance_of ( MicrosoftPatchFinder :: GoogleMsbSearch ) . to receive ( :send_http_request ) { |info_obj , info_opts , opts |
560
562
res = Rex ::Proto ::Http ::Response . new
561
563
allow ( res ) . to receive ( :body ) . and_return ( json_data )
562
564
res
@@ -608,7 +610,7 @@ def get_stderr(&block)
608
610
609
611
end
610
612
611
- describe MicrosoftPatch :: Module do
613
+ describe MicrosoftPatchFinder :: Driver do
612
614
613
615
let ( :msb ) do
614
616
'ms15-100'
@@ -620,17 +622,19 @@ def get_stderr(&block)
620
622
621
623
before ( :each ) do
622
624
opts = { keyword : msb }
623
- allow ( MicrosoftPatch ::OptsConsole ) . to receive ( :get_parsed_options ) . and_return ( opts )
624
- allow_any_instance_of ( MicrosoftPatch ::PatchLinkCollector ) . to receive ( :download_advisory ) . and_return ( Rex ::Proto ::Http ::Response . new )
625
- allow_any_instance_of ( MicrosoftPatch ::PatchLinkCollector ) . to receive ( :get_details_aspx ) . and_return ( [ expected_link ] )
626
- allow_any_instance_of ( MicrosoftPatch ::PatchLinkCollector ) . to receive ( :get_download_page ) . and_return ( Rex ::Proto ::Http ::Response . new )
627
- allow_any_instance_of ( MicrosoftPatch ::PatchLinkCollector ) . to receive ( :get_download_links ) . and_return ( [ expected_link ] )
628
- allow_any_instance_of ( MicrosoftPatch ::Base ) . to receive ( :print_debug )
629
- allow_any_instance_of ( MicrosoftPatch ::Base ) . to receive ( :print_error )
625
+ allow ( MicrosoftPatchFinder ::OptsConsole ) . to receive ( :get_parsed_options ) . and_return ( opts )
626
+ allow_any_instance_of ( MicrosoftPatchFinder ::PatchLinkCollector ) . to receive ( :download_advisory ) . and_return ( Rex ::Proto ::Http ::Response . new )
627
+ allow_any_instance_of ( MicrosoftPatchFinder ::PatchLinkCollector ) . to receive ( :get_details_aspx ) . and_return ( [ expected_link ] )
628
+ allow_any_instance_of ( MicrosoftPatchFinder ::PatchLinkCollector ) . to receive ( :get_download_page ) . and_return ( Rex ::Proto ::Http ::Response . new )
629
+ allow_any_instance_of ( MicrosoftPatchFinder ::PatchLinkCollector ) . to receive ( :get_download_links ) . and_return ( [ expected_link ] )
630
+ allow_any_instance_of ( MicrosoftPatchFinder ::Driver ) . to receive ( :print_debug )
631
+ allow_any_instance_of ( MicrosoftPatchFinder ::Driver ) . to receive ( :print_error )
632
+ allow_any_instance_of ( MicrosoftPatchFinder ::PatchLinkCollector ) . to receive ( :print_debug )
633
+ allow_any_instance_of ( MicrosoftPatchFinder ::PatchLinkCollector ) . to receive ( :print_error )
630
634
end
631
635
632
636
subject do
633
- MicrosoftPatch :: Module . new
637
+ MicrosoftPatchFinder :: Driver . new
634
638
end
635
639
636
640
describe '#get_download_links' do
@@ -643,13 +647,13 @@ def get_stderr(&block)
643
647
644
648
describe '#google_search' do
645
649
it 'returns search results' do
646
- skip ( 'See rspec for MicrosoftPatch ::GoogleMsbSearch#find_msb_numbers' )
650
+ skip ( 'See rspec for MicrosoftPatchFinder ::GoogleMsbSearch#find_msb_numbers' )
647
651
end
648
652
end
649
653
650
654
describe '#technet_search' do
651
655
it 'returns search results' do
652
- skip ( 'See rspec for MicrosoftPatch ::TechnetMsbSearch#find_msb_numbers' )
656
+ skip ( 'See rspec for MicrosoftPatchFinder ::TechnetMsbSearch#find_msb_numbers' )
653
657
end
654
658
end
655
659
0 commit comments