Skip to content

Commit f266ca9

Browse files
committed
Use allow_any_instance_of as with rspec 3
1 parent 768b509 commit f266ca9

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

spec/lib/metasploit/framework/login_scanner/glassfish_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117
end
118118

119119
before :each do
120-
allow_any_instance_of(Rex::Proto::Http::Client).to receive(:send_recv) do |req|
120+
allow_any_instance_of(Rex::Proto::Http::Client).to receive(:send_recv) do |cli, req|
121121
if req.opts['uri'] && req.opts['uri'].include?('j_security_check') &&
122122
req.opts['data'] &&
123123
req.opts['data'].include?("j_username=#{username}") &&
@@ -157,7 +157,7 @@
157157
end
158158

159159
before :each do
160-
allow_any_instance_of(Rex::Proto::Http::Client).to receive(:send_recv) do |req|
160+
allow_any_instance_of(Rex::Proto::Http::Client).to receive(:send_recv) do |cli, req|
161161
if req.opts['uri'] && req.opts['uri'].include?('j_security_check') &&
162162
req.opts['data'] &&
163163
req.opts['data'].include?("j_username=#{username}") &&

spec/spec_helper.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@
2929
end
3030

3131
RSpec.configure do |config|
32-
config.mock_with :rspec
32+
config.mock_with :rspec do |mocks|
33+
mocks.yield_receiver_to_any_instance_implementation_blocks = true
34+
end
3335

3436
# Run specs in random order to surface order dependencies. If you find an
3537
# order dependency and want to debug it, you can fix the order by providing

0 commit comments

Comments
 (0)