.any_instance -> *_any_isntance_of()

MSP-13484
bug/bundler_fix
Luke Imhoff 2015-10-20 15:13:50 -05:00 committed by Brent Cook
parent d7d484a862
commit d1f64363b1
3 changed files with 7 additions and 6 deletions

View File

@ -24,14 +24,14 @@ RSpec.describe Metasploit::Framework::LoginScanner::VNC do
end
it 'returns a connection_error result when the handshake fails' do
expect(Rex::Proto::RFB::Client.any_instance).to receive(:handshake).and_return false
expect_any_instance_of(Rex::Proto::RFB::Client).to receive(:handshake).and_return false
result = login_scanner.attempt_login(test_cred)
expect(result.status).to eq Metasploit::Model::Login::Status::UNABLE_TO_CONNECT
end
it 'returns a failed result when authentication fails' do
expect(Rex::Proto::RFB::Client.any_instance).to receive(:handshake).and_return true
expect(Rex::Proto::RFB::Client.any_instance).to receive(:authenticate).with(private).and_return false
expect_any_instance_of(Rex::Proto::RFB::Client).to receive(:handshake).and_return true
expect_any_instance_of(Rex::Proto::RFB::Client).to receive(:authenticate).with(private).and_return false
result = login_scanner.attempt_login(test_cred)
expect(result.status).to eq Metasploit::Model::Login::Status::INCORRECT
end

View File

@ -62,9 +62,10 @@ RSpec.describe Msf::EncodedPayload do
end
context 'when passed a valid payload instance' do
# don't ever actually generate payload bytes
before { described_class.any_instance.stub(:generate) }
before(:each) do
allow_any_instance_of(described_class).to receive(:generate)
end
it 'returns an Msf::EncodedPayload instance' do
expect(encoded_payload).to be_a(described_class)

View File

@ -174,7 +174,7 @@ shared_examples_for 'Msf::ModuleManager::Cache' do
end
it 'should force load using #load_module on the loader' do
expect(Msf::Modules::Loader::Directory.any_instance).to receive(
expect_any_instance_of(Msf::Modules::Loader::Directory).to receive(
:load_module
).with(
parent_path,