.should_not -> expect().not_to

MSP-13484
bug/bundler_fix
Luke Imhoff 2015-10-21 08:14:48 -05:00 committed by Brent Cook
parent 64a870aac0
commit 05585acb89
16 changed files with 43 additions and 43 deletions

View File

@ -466,14 +466,14 @@ RSpec.describe Msf::Exploit::Powershell do
opt_length = opts.length - 1
short_args.should_not be_nil
long_args.should_not be_nil
expect(short_args).not_to be_nil
expect(long_args).not_to be_nil
expect(short_args.count('-')).to eql opt_length
expect(long_args.count('-')).to eql opt_length
short_args[0].should_not eql " "
long_args[0].should_not eql " "
short_args[-1].should_not eql " "
long_args[-1].should_not eql " "
expect(short_args[0]).not_to eql " "
expect(long_args[0]).not_to eql " "
expect(short_args[-1]).not_to eql " "
expect(long_args[-1]).not_to eql " "
if opts[:command]
expect(long_args[-10..-1]).to eql "-Command Z"

View File

@ -149,7 +149,7 @@ RSpec.describe Msf::Modules::Loader::Base do
# successful.
end
error.should_not be_nil
expect(error).not_to be_nil
expect(error.backtrace[0]).to include(module_path)
end
end
@ -1056,7 +1056,7 @@ RSpec.describe Msf::Modules::Loader::Base do
current_constant = Msf::Modules.const_get(relative_name)
current_constant.should_not be_nil
expect(current_constant).not_to be_nil
expect(current_constant).not_to eq @existent_namespace_module
end
@ -1344,7 +1344,7 @@ RSpec.describe Msf::Modules::Loader::Base do
context 'without metasploit_class responding to is_usable' do
it 'should return true' do
metasploit_class = double('Metasploit Class')
metasploit_class.should_not respond_to(:is_usable)
expect(metasploit_class).not_to respond_to(:is_usable)
expect(subject.send(:usable?, metasploit_class)).to be_truthy
end

View File

@ -157,7 +157,7 @@ RSpec.describe Msf::Modules::Namespace do
rescue Msf::Modules::MetasploitClassCompatibilityError => error
end
error.should_not be_nil
expect(error).not_to be_nil
expect(error.to_s).to include(module_path)
end
@ -169,7 +169,7 @@ RSpec.describe Msf::Modules::Namespace do
rescue Msf::Modules::MetasploitClassCompatibilityError => error
end
error.should_not be_nil
expect(error).not_to be_nil
expect(error.to_s).to include(module_reference_name)
end
end

View File

@ -51,7 +51,7 @@ RSpec.describe Rex::Exploitation::RopDb do
gadgets1 = ropdb.select_rop('msvcrt')
gadgets2 = ropdb.select_rop('msvcrt', {'base'=>0x10000000})
gadgets2[0].should_not eq(gadgets1[0])
expect(gadgets2[0]).not_to eq(gadgets1[0])
end
end

View File

@ -125,15 +125,15 @@ RSpec.describe Rex::Parser::GPP do
it "Parse returns results for xml_ms and password is empty" do
results = GPP.parse(xml_ms)
results.should_not be_empty
expect(results).not_to be_empty
expect(results[0][:PASS]).to be_empty
end
it "Parse returns results for xml_datasrc, and attributes, and password is test1" do
results = GPP.parse(xml_datasrc)
results.should_not be_empty
expect(results).not_to be_empty
expect(results[0].include?(:ATTRIBUTES)).to be_truthy
results[0][:ATTRIBUTES].should_not be_empty
expect(results[0][:ATTRIBUTES]).not_to be_empty
expect(results[0][:PASS]).to eq("test")
end
@ -147,8 +147,8 @@ RSpec.describe Rex::Parser::GPP do
it "Parse returns results for all good xmls and passwords" do
xmls.each do |xml|
results = GPP.parse(xml)
results.should_not be_empty
results[0][:PASS].should_not be_empty
expect(results).not_to be_empty
expect(results[0][:PASS]).not_to be_empty
end
end
@ -159,7 +159,7 @@ RSpec.describe Rex::Parser::GPP do
xmls.each do |xml|
results = GPP.parse(xml)
tables = GPP.create_tables(results, "test")
tables.should_not be_empty
expect(tables).not_to be_empty
end
end
end

View File

@ -29,7 +29,7 @@ RSpec.describe Rex::Parser::NmapXMLStreamParser do
parser.on_found_host = Proc.new { |host|
total_hosts += 1
it "should yield a host" do
host.should_not be_nil
expect(host).not_to be_nil
end
it "should populate the host with proper keys" do
expect(host).to have_key("status")

View File

@ -35,7 +35,7 @@ RSpec.describe Rex::Parser::Unattend do
it "returns results for all positive examples" do
pos_xmls.each do |xml|
results = described_class.parse(xml)
results.should_not be_empty
expect(results).not_to be_empty
end
end

View File

@ -385,14 +385,14 @@ RSpec.describe Rex::Powershell::Command do
opt_length = opts.length - 1
short_args.should_not be_nil
long_args.should_not be_nil
expect(short_args).not_to be_nil
expect(long_args).not_to be_nil
expect(short_args.count('-')).to eql opt_length
expect(long_args.count('-')).to eql opt_length
short_args[0].should_not eql " "
long_args[0].should_not eql " "
short_args[-1].should_not eql " "
long_args[-1].should_not eql " "
expect(short_args[0]).not_to eql " "
expect(long_args[0]).not_to eql " "
expect(short_args[-1]).not_to eql " "
expect(long_args[-1]).not_to eql " "
if opts[:command]
expect(long_args[-10..-1]).to eql "-Command Z"

View File

@ -113,7 +113,7 @@ RSpec.describe Rex::Proto::Http::Client do
it "should not send creds on the first request in order to induce a 401" do
req = cli.request_cgi
req.to_s.should_not match("Authorization:")
expect(req.to_s).not_to match("Authorization:")
end
it "should send creds after receiving a 401" do
@ -125,7 +125,7 @@ RSpec.describe Rex::Proto::Http::Client do
expect(conn).to receive(:get_once).and_return(first_response, authed_response)
expect(conn).to receive(:put) do |str_request|
str_request.should_not include("Authorization")
expect(str_request).not_to include("Authorization")
nil
end
expect(conn).to receive(:put) do |str_request|
@ -170,7 +170,7 @@ RSpec.describe Rex::Proto::Http::Client do
it "should test for credentials" do
skip "Should actually respond to :has_creds" do
cli.should_not have_creds
expect(cli).not_to have_creds
this_cli = described_class.new("127.0.0.1", 1, {}, false, nil, nil, "user1", "pass1" )
expect(this_cli).to have_creds
end
@ -206,7 +206,7 @@ RSpec.describe Rex::Proto::Http::Client do
end
it "should tell if pipelining is enabled" do
cli.should_not be_pipelining
expect(cli).not_to be_pipelining
this_cli = Rex::Proto::Http::Client.new("127.0.0.1", 1)
this_cli.pipeline = true
expect(this_cli).to be_pipelining

View File

@ -191,8 +191,8 @@ RSpec.describe Rex::Proto::Http::Response do
resp = described_class.new()
resp.parse(self.send meth)
cookies = resp.get_cookies
cookies.should_not be_nil
cookies.should_not be ''
expect(cookies).not_to be_nil
expect(cookies).not_to be ''
cookies.split(';').map(&:strip)
end

View File

@ -35,7 +35,7 @@ RSpec.describe Rex::RandomIdentifierGenerator do
expect(ident).to match(/\A[a-z0-9_]*\Z/)
ident = subject.generate { |identifier| identifier.gsub("A","B") }
ident.should_not include("A")
expect(ident).not_to include("A")
end
end

View File

@ -75,12 +75,12 @@ RSpec.describe Rex::Socket::RangeWalker do
it 'should reject CIDR ranges with missing octets' do
walker = Rex::Socket::RangeWalker.new('192.168/24')
walker.should_not be_valid
expect(walker).not_to be_valid
end
it 'should reject a CIDR range with too many octets' do
walker = Rex::Socket::RangeWalker.new('192.168.1.2.0/24')
walker.should_not be_valid
expect(walker).not_to be_valid
end
it "should default the lower bound of a range to 0" do
@ -118,7 +118,7 @@ RSpec.describe Rex::Socket::RangeWalker do
walker = Rex::Socket::RangeWalker.new("10.1.1.1,3")
expect(walker).to be_valid
expect(walker.length).to eq 2
walker.should_not include("10.1.1.2")
expect(walker).not_to include("10.1.1.2")
end
it "should produce the same ranges with * and 0-255" do

View File

@ -93,7 +93,7 @@ RSpec.describe Rex::SSLScan::Scanner do
subject.send(:initialize, 'google.com', 443)
end
it "should mark SSLv2 as unsupported" do
subject.supported_versions.should_not include :SSLv2
expect(subject.supported_versions).not_to include :SSLv2
expect(subject.sslv2).to eq false
end

View File

@ -10,7 +10,7 @@ shared_examples_for 'Msf::DBManager::Export#extract_module_detail_info module_de
end
it "should not have Mdm::Module::Detail##{attribute_name} nil" do
attribute.should_not be_nil
expect(attribute).not_to be_nil
end
it "should have Mdm::Module::Detail##{attribute_name} for #{child_node_name} content" do

View File

@ -9,7 +9,7 @@ shared_examples_for 'Msf::ModuleManager::ModulePaths' do
path_with_trailing_separator = path + File::SEPARATOR
module_manager.add_module_path(path_with_trailing_separator)
module_paths.should_not include(path_with_trailing_separator)
expect(module_paths).not_to include(path_with_trailing_separator)
expect(module_paths).to include(path)
end
end

View File

@ -22,15 +22,15 @@ shared_examples_for 'an xor encoder' do |keysize|
if keysize > 1
it "should deal with input lengths that aren't a multiple of keysize" do
lambda {
expect {
encoded, key = described_class.encode("A"*(keysize+1), "A"*keysize)
expect(encoded).to eql("\x00"*(keysize+1))
}.should_not raise_error
}.not_to raise_error
lambda {
expect {
encoded, key = described_class.encode("A"*(keysize-1), "A"*keysize)
expect(encoded).to eql("\x00"*(keysize-1))
}.should_not raise_error
}.not_to raise_error
end
end