Skip to content

Commit 5862a66

Browse files
committed
Pass specs again
1 parent 69f3d88 commit 5862a66

File tree

1 file changed

+32
-28
lines changed

1 file changed

+32
-28
lines changed

spec/tools/msu_finder_spec.rb

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@
1414
end
1515

1616
let(:technet) do
17-
MicrosoftPatch::SiteInfo::TECHNET
17+
MicrosoftPatchFinder::SiteInfo::TECHNET
1818
end
1919

2020
let(:microsoft) do
21-
MicrosoftPatch::SiteInfo::MICROSOFT
21+
MicrosoftPatchFinder::SiteInfo::MICROSOFT
2222
end
2323

2424
let(:googleapis) do
25-
MicrosoftPatch::SiteInfo::GOOGLEAPIS
25+
MicrosoftPatchFinder::SiteInfo::GOOGLEAPIS
2626
end
2727

28-
describe MicrosoftPatch::SiteInfo do
28+
describe MicrosoftPatchFinder::SiteInfo do
2929
context 'Constants' do
3030
context 'TECHNET' do
3131
it 'returns 157.56.148.23 as the IP' do
@@ -59,7 +59,7 @@
5959
end
6060
end
6161

62-
describe MicrosoftPatch::Base do
62+
describe MicrosoftPatchFinder::Helper do
6363

6464
def get_stdout(&block)
6565
out = $stdout
@@ -84,7 +84,9 @@ def get_stderr(&block)
8484
end
8585

8686
subject do
87-
MicrosoftPatch::Base.new
87+
mod = Object.new
88+
mod.extend MicrosoftPatchFinder::Helper
89+
mod
8890
end
8991

9092
describe '#print_debug' do
@@ -119,14 +121,14 @@ def get_stderr(&block)
119121
describe '#send_http_request' do
120122
it 'returns a Rex::Proto::Http::Response object' do
121123
allow(subject).to receive(:print_debug)
122-
res = subject.send_http_request(MicrosoftPatch::SiteInfo::TECHNET)
124+
res = subject.send_http_request(MicrosoftPatchFinder::SiteInfo::TECHNET)
123125
expect(res).to be_kind_of(Rex::Proto::Http::Response)
124126
end
125127
end
126128

127129
end
128130

129-
describe MicrosoftPatch::PatchLinkCollector do
131+
describe MicrosoftPatchFinder::PatchLinkCollector do
130132

131133
let(:ms15_100_html) do
132134
%Q|
@@ -199,7 +201,7 @@ def get_stderr(&block)
199201
end
200202

201203
subject do
202-
MicrosoftPatch::PatchLinkCollector.new
204+
MicrosoftPatchFinder::PatchLinkCollector.new
203205
end
204206

205207
before(:each) do
@@ -361,15 +363,15 @@ def get_stderr(&block)
361363

362364
end
363365

364-
describe MicrosoftPatch::TechnetMsbSearch do
366+
describe MicrosoftPatchFinder::TechnetMsbSearch do
365367

366368
subject do
367-
MicrosoftPatch::TechnetMsbSearch.new
369+
MicrosoftPatchFinder::TechnetMsbSearch.new
368370
end
369371

370372
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|
373375
case opts['uri']
374376
when /\/en\-us\/security\/bulletin\/dn602597\.aspx/
375377
html = %Q|
@@ -465,10 +467,10 @@ def get_stderr(&block)
465467

466468
end
467469

468-
describe MicrosoftPatch::GoogleMsbSearch do
470+
describe MicrosoftPatchFinder::GoogleMsbSearch do
469471

470472
subject do
471-
MicrosoftPatch::GoogleMsbSearch.new
473+
MicrosoftPatchFinder::GoogleMsbSearch.new
472474
end
473475

474476
let(:json_data) do
@@ -555,8 +557,8 @@ def get_stderr(&block)
555557
end
556558

557559
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|
560562
res = Rex::Proto::Http::Response.new
561563
allow(res).to receive(:body).and_return(json_data)
562564
res
@@ -608,7 +610,7 @@ def get_stderr(&block)
608610

609611
end
610612

611-
describe MicrosoftPatch::Module do
613+
describe MicrosoftPatchFinder::Driver do
612614

613615
let(:msb) do
614616
'ms15-100'
@@ -620,17 +622,19 @@ def get_stderr(&block)
620622

621623
before(:each) do
622624
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)
630634
end
631635

632636
subject do
633-
MicrosoftPatch::Module.new
637+
MicrosoftPatchFinder::Driver.new
634638
end
635639

636640
describe '#get_download_links' do
@@ -643,13 +647,13 @@ def get_stderr(&block)
643647

644648
describe '#google_search' do
645649
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')
647651
end
648652
end
649653

650654
describe '#technet_search' do
651655
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')
653657
end
654658
end
655659

0 commit comments

Comments
 (0)