diff --git a/spec/support/shared/contexts/msf/db_manager.rb b/spec/support/shared/contexts/msf/db_manager.rb index 610f382412..4991038b2d 100644 --- a/spec/support/shared/contexts/msf/db_manager.rb +++ b/spec/support/shared/contexts/msf/db_manager.rb @@ -12,6 +12,6 @@ RSpec.shared_context 'Msf::DBManager' do before(:each) do # already connected due to use_transactional_fixtures, but need some of the side-effects of #connect framework.db.workspace = framework.db.default_workspace - expect(db_manager).to receive(:active).and_return(active) + allow(db_manager).to receive(:active).and_return(active) end end diff --git a/spec/support/shared/examples/msf/db_manager/exploit_attempt.rb b/spec/support/shared/examples/msf/db_manager/exploit_attempt.rb index 4042cfd67c..bf979b2e7b 100644 --- a/spec/support/shared/examples/msf/db_manager/exploit_attempt.rb +++ b/spec/support/shared/examples/msf/db_manager/exploit_attempt.rb @@ -127,8 +127,8 @@ shared_examples_for 'Msf::DBManager::ExploitAttempt' do expect(db_manager).not_to receive(:create_match_result) end - it "should not call create_run_for_vuln" do - expect(db_manager).not_to receive(:create_run_for_vuln) + it "should not call create_match_for_vuln" do + expect(db_manager).not_to receive(:create_match_for_vuln) end end diff --git a/spec/support/shared/examples/msf/db_manager/import/metasploit_framework/xml.rb b/spec/support/shared/examples/msf/db_manager/import/metasploit_framework/xml.rb index bdb8e7e361..4355db7350 100644 --- a/spec/support/shared/examples/msf/db_manager/import/metasploit_framework/xml.rb +++ b/spec/support/shared/examples/msf/db_manager/import/metasploit_framework/xml.rb @@ -245,7 +245,7 @@ shared_examples_for 'Msf::DBManager::Import::MetasploitFramework::XML' do end it 'should return an empty Hash' do - expect(info).to eq {} + expect(info).to eq({}) end end end @@ -390,7 +390,7 @@ shared_examples_for 'Msf::DBManager::Import::MetasploitFramework::XML' do end before(:each) do - expect(db_manager).to receive(:import_msf_text_element).and_return(returned_hash) + allow(db_manager).to receive(:import_msf_text_element).and_return(returned_hash) end it 'should pass returned Hash as part of Hash passed to report_web_<:type' do diff --git a/spec/support/shared/examples/msf/db_manager/module_cache.rb b/spec/support/shared/examples/msf/db_manager/module_cache.rb index 8ca374f63f..f508abc1ac 100644 --- a/spec/support/shared/examples/msf/db_manager/module_cache.rb +++ b/spec/support/shared/examples/msf/db_manager/module_cache.rb @@ -27,7 +27,7 @@ shared_examples_for 'Msf::DBManager::ModuleCache' do end before(:each) do - expect(db_manager).to receive(:migrated).and_return(migrated) + allow(db_manager).to receive(:migrated).and_return(migrated) end context 'with migrated' do @@ -40,7 +40,7 @@ shared_examples_for 'Msf::DBManager::ModuleCache' do end before(:each) do - expect(db_manager).to receive(:modules_caching).and_return(modules_caching) + allow(db_manager).to receive(:modules_caching).and_return(modules_caching) end context 'with modules_caching' do @@ -97,7 +97,7 @@ shared_examples_for 'Msf::DBManager::ModuleCache' do end before(:each) do - expect(db_manager).to receive(:migrated).and_return(migrated) + allow(db_manager).to receive(:migrated).and_return(migrated) end context 'with migrated' do @@ -169,7 +169,7 @@ shared_examples_for 'Msf::DBManager::ModuleCache' do end it "should match Mdm::Module::Detail#stance 'passive'" do - expect(module_details.count).to > 0 + expect(module_details.count).to be > 0 expect( module_details.all? { |module_detail| @@ -185,7 +185,7 @@ shared_examples_for 'Msf::DBManager::ModuleCache' do end it "should match Mdm::Module::Detail#stance 'aggressive'" do - expect(module_details.count).to > 0 + expect(module_details.count).to be > 0 expect( module_details.all? { |module_detail| @@ -216,7 +216,7 @@ shared_examples_for 'Msf::DBManager::ModuleCache' do end it 'should match Mdm::Module::Author#email' do - expect(module_details.count).to > 0 + expect(module_details.count).to be > 0 expect( module_details.all? { |module_detail| @@ -235,7 +235,7 @@ shared_examples_for 'Msf::DBManager::ModuleCache' do end it 'should match Mdm::Module::Author#name' do - expect(module_details.count).to > 0 + expect(module_details.count).to be > 0 expect( module_details.all? { |module_detail| @@ -271,7 +271,7 @@ shared_examples_for 'Msf::DBManager::ModuleCache' do end it 'should match Mdm::Module::Detail#fullname' do - expect(module_details.count).to > 0 + expect(module_details.count).to be > 0 expect( module_details.all? { |module_detail| @@ -288,7 +288,7 @@ shared_examples_for 'Msf::DBManager::ModuleCache' do end it 'should match Mdm::Module::Detail#name' do - expect(module_details.count).to > 0 + expect(module_details.count).to be > 0 expect( module_details.all? { |module_detail| @@ -325,7 +325,7 @@ shared_examples_for 'Msf::DBManager::ModuleCache' do end it 'should match Mdm::Module::Ref#name' do - expect(module_details.count).to > 0 + expect(module_details.count).to be > 0 expect( module_details.all? { |module_detail| @@ -367,7 +367,7 @@ shared_examples_for 'Msf::DBManager::ModuleCache' do end it 'should match Mdm::Module::Detail#mtype' do - expect(module_details.count).to > 0 + expect(module_details.count).to be > 0 expect( module_details.all? { |module_detail| @@ -395,7 +395,7 @@ shared_examples_for 'Msf::DBManager::ModuleCache' do end it 'should match Mdm::Module::Action#name' do - expect(module_details.count).to > 0 + expect(module_details.count).to be > 0 expect( module_details.all? { |module_detail| @@ -417,7 +417,7 @@ shared_examples_for 'Msf::DBManager::ModuleCache' do end it 'should match Mdm::Module::Arch#name' do - expect(module_details.count).to > 0 + expect(module_details.count).to be > 0 expect( module_details.all? { |module_detail| @@ -439,7 +439,7 @@ shared_examples_for 'Msf::DBManager::ModuleCache' do end it 'should match Mdm::Module::Author#name' do - expect(module_details.count).to > 0 + expect(module_details.count).to be > 0 expect( module_details.all? { |module_detail| @@ -521,7 +521,7 @@ shared_examples_for 'Msf::DBManager::ModuleCache' do end it 'should match Mdm::Module::Platform#name' do - expect(module_details.count).to > 0 + expect(module_details.count).to be > 0 expect( module_details.all? { |module_detail| @@ -543,7 +543,7 @@ shared_examples_for 'Msf::DBManager::ModuleCache' do end it 'should match Mdm::Module::Ref#name' do - expect(module_details.count).to > 0 + expect(module_details.count).to be > 0 expect( module_details.all? { |module_detail| @@ -565,7 +565,7 @@ shared_examples_for 'Msf::DBManager::ModuleCache' do end it 'should match Mdm::Module::Target#name' do - expect(module_details.count).to > 0 + expect(module_details.count).to be > 0 expect( module_details.all? { |module_detail| @@ -589,7 +589,7 @@ shared_examples_for 'Msf::DBManager::ModuleCache' do end before(:each) do - expect(db_manager).to receive(:migrated).and_return(migrated) + allow(db_manager).to receive(:migrated).and_return(migrated) end context 'with migrated' do @@ -602,7 +602,7 @@ shared_examples_for 'Msf::DBManager::ModuleCache' do end before(:each) do - expect(db_manager).to receive(:modules_caching).and_return(modules_caching) + allow(db_manager).to receive(:modules_caching).and_return(modules_caching) end context 'with modules_caching' do @@ -805,7 +805,7 @@ shared_examples_for 'Msf::DBManager::ModuleCache' do end before(:each) do - expect(db_manager).to receive(:migrated).and_return(migrated) + allow(db_manager).to receive(:migrated).and_return(migrated) end context 'with migrated' do diff --git a/spec/support/shared/examples/msf/db_manager/search_modules/mdm_module_platform_name_or_mdm_module_target_name_keyword.rb b/spec/support/shared/examples/msf/db_manager/search_modules/mdm_module_platform_name_or_mdm_module_target_name_keyword.rb index 588ae2525c..50e31d729e 100644 --- a/spec/support/shared/examples/msf/db_manager/search_modules/mdm_module_platform_name_or_mdm_module_target_name_keyword.rb +++ b/spec/support/shared/examples/msf/db_manager/search_modules/mdm_module_platform_name_or_mdm_module_target_name_keyword.rb @@ -19,7 +19,7 @@ shared_examples_for 'Msf::DBManager#search_modules Mdm::Module::Platform#name or end it 'should find matching Mdm::Module::Platform#name' do - expect(module_details.count).to > 0 + expect(module_details.count).to be > 0 expect( module_details.all? { |module_detail| @@ -38,7 +38,7 @@ shared_examples_for 'Msf::DBManager#search_modules Mdm::Module::Platform#name or end it 'should find matching Mdm::Module::Target#name' do - expect(module_details.count).to > 0 + expect(module_details.count).to be > 0 expect( module_details.all? { |module_detail| diff --git a/spec/support/shared/examples/msf/db_manager/search_modules/mdm_module_ref_name_keyword.rb b/spec/support/shared/examples/msf/db_manager/search_modules/mdm_module_ref_name_keyword.rb index 1ac9e8b9f4..0fa8c98e20 100644 --- a/spec/support/shared/examples/msf/db_manager/search_modules/mdm_module_ref_name_keyword.rb +++ b/spec/support/shared/examples/msf/db_manager/search_modules/mdm_module_ref_name_keyword.rb @@ -25,7 +25,7 @@ shared_examples_for 'Msf::DBManager#search_modules Mdm::Module::Ref#name keyword end it 'should match Mdm::Module::Ref#name' do - expect(module_details.count).to > 0 + expect(module_details.count).to be > 0 expect( module_details.all? { |module_detail| diff --git a/spec/support/shared/examples/msf/db_manager/session.rb b/spec/support/shared/examples/msf/db_manager/session.rb index c65e9d2599..acf862bf52 100644 --- a/spec/support/shared/examples/msf/db_manager/session.rb +++ b/spec/support/shared/examples/msf/db_manager/session.rb @@ -84,6 +84,7 @@ shared_examples_for 'Msf::DBManager::Session' do Class.new do include Msf::Session + attr_accessor :arch attr_accessor :exploit attr_accessor :datastore attr_accessor :platform @@ -123,7 +124,7 @@ shared_examples_for 'Msf::DBManager::Session' do context 'with a run_id in user_data' do before(:each) do - MetasploitDataModels::AutomaticExploitation::MatchSet.any_instance.stub(:create_match_for_vuln).and_return(nil) + allow(db_manager).to receive(:create_match_for_vuln).and_return(nil) end let(:match_set) do @@ -192,7 +193,7 @@ shared_examples_for 'Msf::DBManager::Session' do end before(:each) do - expect(session).to receive(:arch).and_return(arch) + allow(session).to receive(:arch).and_return(arch) end it 'should pass :arch to #find_or_create_host' do @@ -437,7 +438,7 @@ shared_examples_for 'Msf::DBManager::Session' do context "with session.exploit_datastore['ParentModule']" do it "should have session.exploit_datastore['ParentModule']" do - session.exploit_datastore['ParentModule'].should_not be_nil + expect(session.exploit_datastore['ParentModule']).not_to be_nil end it { expect(subject.via_exploit).to eq(parent_module_fullname) } @@ -516,9 +517,9 @@ shared_examples_for 'Msf::DBManager::Session' do context 'with workspace from either :workspace or session' do it 'should pass normalized host from session as :host to #find_or_create_host' do normalized_host = double('Normalized Host') - expect(db_manager).to receive(:normalize_host).with(session).and_return(normalized_host) + allow(db_manager).to receive(:normalize_host).with(session).and_return(normalized_host) # stub report_vuln so its use of find_or_create_host and normalize_host doesn't interfere. - expect(db_manager).to receive(:report_vuln) + allow(db_manager).to receive(:report_vuln) expect(db_manager).to receive(:find_or_create_host).with( hash_including( @@ -535,7 +536,7 @@ shared_examples_for 'Msf::DBManager::Session' do end before(:each) do - expect(session).to receive(:arch).and_return(arch) + allow(session).to receive(:arch).and_return(arch) end it 'should pass :arch to #find_or_create_host' do @@ -780,7 +781,7 @@ shared_examples_for 'Msf::DBManager::Session' do context "with session.exploit_datastore['ParentModule']" do it "should have session.exploit_datastore['ParentModule']" do - session.exploit_datastore['ParentModule'].should_not be_nil + expect(session.exploit_datastore['ParentModule']).not_to be_nil end it { expect(subject.via_exploit).to eq(parent_module_fullname) }