Land #3739, knock out rspec deprecations
commit
67786e34ae
|
@ -91,7 +91,7 @@ describe FastLib do
|
|||
FastLib.cache[@destination_path][:fastlib_flags].should == flags
|
||||
end
|
||||
|
||||
pending "Fix https://www.pivotaltracker.com/story/show/38730815" do
|
||||
skip "Fix https://www.pivotaltracker.com/story/show/38730815" do
|
||||
it 'should include header' do
|
||||
described_class.dump(@destination_path, flag_string, base_path, *unarchived_paths)
|
||||
header = FastLib.cache[@destination_path][:fastlib_header]
|
||||
|
@ -198,7 +198,8 @@ describe FastLib do
|
|||
end
|
||||
end
|
||||
|
||||
context 'with cached dump', :pending => "Fix https://www.pivotaltracker.com/story/show/38730815" do
|
||||
skip "Fix https://www.pivotaltracker.com/story/show/38730815" do
|
||||
context 'with cached dump' do
|
||||
it 'should have dump cached' do
|
||||
FastLib.cache[@destination_path].should_not be_nil
|
||||
end
|
||||
|
@ -210,6 +211,7 @@ describe FastLib do
|
|||
paths.should == archived_paths
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'without cached dump' do
|
||||
before(:each) do
|
||||
|
|
|
@ -37,16 +37,16 @@ describe Msf::Exploit::Capture do
|
|||
subject.should respond_to :open_pcap
|
||||
end
|
||||
|
||||
it 'should confirm that pcaprub is available', :pending => "Need to test this without stubbing check_pcaprub_loaded" do
|
||||
it 'should confirm that pcaprub is available', :skip => "Need to test this without stubbing check_pcaprub_loaded" do
|
||||
end
|
||||
|
||||
it 'should open a pcap file', :pending => "Provde a sample pcap file to read" do
|
||||
it 'should open a pcap file', :skip => "Provde a sample pcap file to read" do
|
||||
end
|
||||
|
||||
it 'should capture from an iface', :pending => "Mock this? Tends to need root" do
|
||||
it 'should capture from an iface', :skip => "Mock this? Tends to need root" do
|
||||
end
|
||||
|
||||
it 'should inject packets to an ifrace', :pending => "Mock this? Tends to need root" do
|
||||
it 'should inject packets to an ifrace', :skip => "Mock this? Tends to need root" do
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -364,14 +364,14 @@ describe Msf::Exploit::Powershell do
|
|||
context 'when no_equals is false' do
|
||||
it 'should contain a final payload with -e' do
|
||||
code = subject.cmd_psh_payload(payload, arch, {:encode_final_payload => true, :no_equals => false})
|
||||
code.include?(' -e ').should be_true
|
||||
code.include?(' -e ').should be_truthy
|
||||
code.include?(' -c ').should be_falsey
|
||||
end
|
||||
end
|
||||
context 'when no_equals is true' do
|
||||
it 'should contain a final payload with -e' do
|
||||
code = subject.cmd_psh_payload(payload, arch, {:encode_final_payload => true, :no_equals => true})
|
||||
code.include?(' -e ').should be_true
|
||||
code.include?(' -e ').should be_truthy
|
||||
code.include?(' -c ').should be_falsey
|
||||
code.include?('=').should be_falsey
|
||||
end
|
||||
|
|
|
@ -28,7 +28,7 @@ describe Msf::Framework do
|
|||
"-#{release}".should == described_class::Release
|
||||
end
|
||||
|
||||
pending "conform to SemVer 2.0 syntax: http://semver.org/" do
|
||||
skip "conform to SemVer 2.0 syntax: http://semver.org/" do
|
||||
it "should have constants that correspond to SemVer standards" do
|
||||
major,minor,patch,label = subject.version.split(/[.-]/)
|
||||
major.to_i.should == described_class::VERSION::MAJOR
|
||||
|
|
|
@ -567,7 +567,7 @@ describe Msf::Modules::Loader::Base do
|
|||
|
||||
it 'should restore the old namespace module' do
|
||||
subject.load_module(parent_path, type, module_reference_name).should be_falsey
|
||||
Msf::Modules.const_defined?(relative_name).should be_true
|
||||
Msf::Modules.const_defined?(relative_name).should be_truthy
|
||||
Msf::Modules.const_get(relative_name).should == @original_namespace_module
|
||||
end
|
||||
end
|
||||
|
@ -602,7 +602,7 @@ describe Msf::Modules::Loader::Base do
|
|||
|
||||
it 'should restore the old namespace module' do
|
||||
subject.load_module(parent_path, type, module_reference_name).should be_falsey
|
||||
Msf::Modules.const_defined?(relative_name).should be_true
|
||||
Msf::Modules.const_defined?(relative_name).should be_truthy
|
||||
Msf::Modules.const_get(relative_name).should == @original_namespace_module
|
||||
end
|
||||
end
|
||||
|
|
|
@ -313,7 +313,7 @@ describe Msf::PayloadGenerator do
|
|||
|
||||
|
||||
it 'returns modified shellcode' do
|
||||
pending "This is a bad test and needs to be refactored"
|
||||
skip "This is a bad test and needs to be refactored"
|
||||
# The exact length is variable due to random nops inserted into the routine
|
||||
# It looks like it should always be > 300
|
||||
# Can't do precise output matching due to this same issue
|
||||
|
|
|
@ -350,14 +350,14 @@ describe Msf::DBManager do
|
|||
Mdm::Vuln.last
|
||||
end
|
||||
|
||||
its(:host) { should == Mdm::Host.last }
|
||||
its(:refs) { should == [] }
|
||||
its(:exploited_at) { should be_within(1.second).of(Time.now.utc) }
|
||||
it { expect(subject.host).to eq(Mdm::Host.last) }
|
||||
it { expect(subject.refs).to eq([]) }
|
||||
it { expect(subject.exploited_at).to be_within(1.second).of(Time.now.utc) }
|
||||
|
||||
context "with session.via_exploit 'exploit/multi/handler'" do
|
||||
context "with session.exploit_datastore['ParentModule']" do
|
||||
its(:info) { should == "Exploited by #{parent_module_fullname} to create Session #{mdm_session.id}" }
|
||||
its(:name) { should == parent_module_name }
|
||||
it { expect(subject.info).to eq("Exploited by #{parent_module_fullname} to create Session #{mdm_session.id}") }
|
||||
it { expect(subject.name).to eq(parent_module_name) }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -390,8 +390,8 @@ describe Msf::DBManager do
|
|||
session.via_exploit = "#{type}/#{reference_name}"
|
||||
end
|
||||
|
||||
its(:info) { should == "Exploited by #{session.via_exploit} to create Session #{mdm_session.id}"}
|
||||
its(:name) { should == reference_name }
|
||||
it { expect(subject.info).to eq("Exploited by #{session.via_exploit} to create Session #{mdm_session.id}") }
|
||||
it { expect(subject.name).to eq(reference_name) }
|
||||
end
|
||||
|
||||
context 'with RPORT' do
|
||||
|
@ -410,11 +410,11 @@ describe Msf::DBManager do
|
|||
)
|
||||
end
|
||||
|
||||
its(:service) { should == service }
|
||||
it { expect(subject.service).to eq(service) }
|
||||
end
|
||||
|
||||
context 'without RPORT' do
|
||||
its(:service) { should be_nil }
|
||||
it { expect(subject.service).to be_nil }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -439,16 +439,16 @@ describe Msf::DBManager do
|
|||
Mdm::ExploitAttempt.last
|
||||
end
|
||||
|
||||
its(:attempted_at) { should be_within(1.second).of(Time.now.utc) }
|
||||
it { expect(subject.attempted_at).to be_within(1.second).of(Time.now.utc) }
|
||||
# @todo https://www.pivotaltracker.com/story/show/48362615
|
||||
its(:session_id) { should == Mdm::Session.last.id }
|
||||
its(:exploited) { should == true }
|
||||
it { expect(subject.session_id).to eq(Mdm::Session.last.id) }
|
||||
it { expect(subject.exploited).to be_truthy }
|
||||
# @todo https://www.pivotaltracker.com/story/show/48362615
|
||||
its(:vuln_id) { should == Mdm::Vuln.last.id }
|
||||
it { expect(subject.vuln_id).to eq(Mdm::Vuln.last.id) }
|
||||
|
||||
context "with session.via_exploit 'exploit/multi/handler'" do
|
||||
context "with session.datastore['ParentModule']" do
|
||||
its(:module) { should == parent_module_fullname }
|
||||
it { expect(subject.module).to eq(parent_module_fullname) }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -457,7 +457,7 @@ describe Msf::DBManager do
|
|||
session.via_exploit = parent_module_fullname
|
||||
end
|
||||
|
||||
its(:module) { should == session.via_exploit }
|
||||
it { expect(subject.module).to eq(session.via_exploit) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -504,16 +504,16 @@ describe Msf::DBManager do
|
|||
session.via_exploit.should be_present
|
||||
end
|
||||
|
||||
its(:datastore) { should == session.exploit_datastore.to_h }
|
||||
its(:desc) { should == session.info }
|
||||
its(:host_id) { should == Mdm::Host.last.id }
|
||||
its(:last_seen) { should be_within(1.second).of(Time.now.utc) }
|
||||
its(:local_id) { should == session.sid }
|
||||
its(:opened_at) { should be_within(1.second).of(Time.now.utc) }
|
||||
its(:platform) { should == session.platform }
|
||||
its(:routes) { should == [] }
|
||||
its(:stype) { should == session.type }
|
||||
its(:via_payload) { should == session.via_payload }
|
||||
it { expect(subject.datastore).to eq(session.exploit_datastore.to_h) }
|
||||
it { expect(subject.desc).to eq(session.info) }
|
||||
it { expect(subject.host_id).to eq(Mdm::Host.last.id) }
|
||||
it { expect(subject.last_seen).to be_within(1.second).of(Time.now.utc) }
|
||||
it { expect(subject.local_id).to eq(session.sid) }
|
||||
it { expect(subject.opened_at).to be_within(1.second).of(Time.now.utc) }
|
||||
it { expect(subject.platform).to eq(session.platform) }
|
||||
it { expect(subject.routes).to eq([]) }
|
||||
it { expect(subject.stype).to eq(session.type) }
|
||||
it { expect(subject.via_payload).to eq(session.via_payload) }
|
||||
|
||||
context "with session.via_exploit 'exploit/multi/handler'" do
|
||||
it "should have session.via_exploit of 'exploit/multi/handler'" do
|
||||
|
@ -525,7 +525,7 @@ describe Msf::DBManager do
|
|||
session.exploit_datastore['ParentModule'].should_not be_nil
|
||||
end
|
||||
|
||||
its(:via_exploit) { should == parent_module_fullname }
|
||||
it { expect(subject.via_exploit).to eq(parent_module_fullname) }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -559,7 +559,7 @@ describe Msf::DBManager do
|
|||
session.via_exploit.should_not == 'exploit/multi/handler'
|
||||
end
|
||||
|
||||
its(:via_exploit) { should == session.via_exploit }
|
||||
it { expect(subject.via_exploit).to eq(session.via_exploit) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -647,20 +647,20 @@ describe Msf::DBManager do
|
|||
report_session
|
||||
end
|
||||
|
||||
its(:close_reason) { should == close_reason }
|
||||
its(:desc) { should == description }
|
||||
its(:host) { should == host }
|
||||
its(:platform) { should == platform }
|
||||
its(:stype) { should == session_type }
|
||||
its(:via_exploit) { should == exploit_full_name }
|
||||
its(:via_payload) { should == payload_full_name }
|
||||
it { expect(subject.close_reason).to eq(close_reason) }
|
||||
it { expect(subject.desc).to eq(description) }
|
||||
it { expect(subject.host).to eq(host) }
|
||||
it { expect(subject.platform).to eq(platform) }
|
||||
it { expect(subject.stype).to eq(session_type) }
|
||||
it { expect(subject.via_exploit).to eq(exploit_full_name) }
|
||||
it { expect(subject.via_payload).to eq(payload_full_name) }
|
||||
|
||||
context 'with :last_seen' do
|
||||
let(:last_seen) do
|
||||
opened_at
|
||||
end
|
||||
|
||||
its(:last_seen) { should == last_seen }
|
||||
it { expect(subject.last_seen).to eq(last_seen) }
|
||||
end
|
||||
|
||||
context 'with :closed_at' do
|
||||
|
@ -668,11 +668,11 @@ describe Msf::DBManager do
|
|||
opened_at + 1.minute
|
||||
end
|
||||
|
||||
its(:closed_at) { should == closed_at }
|
||||
it { expect(subject.closed_at).to eq(closed_at) }
|
||||
end
|
||||
|
||||
context 'without :closed_at' do
|
||||
its(:closed_at) { should == nil }
|
||||
it { expect(subject.closed_at).to be_nil }
|
||||
end
|
||||
|
||||
context 'without :last_seen' do
|
||||
|
@ -681,11 +681,11 @@ describe Msf::DBManager do
|
|||
opened_at + 1.minute
|
||||
end
|
||||
|
||||
its(:last_seen) { should == closed_at }
|
||||
it { expect(subject.last_seen).to eq(closed_at) }
|
||||
end
|
||||
|
||||
context 'without :closed_at' do
|
||||
its(:last_seen) { should be_nil }
|
||||
it { expect(subject.last_seen).to be_nil }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -698,11 +698,11 @@ describe Msf::DBManager do
|
|||
)
|
||||
end
|
||||
|
||||
its(:routes) { should == routes }
|
||||
it { expect(subject.routes).to eq(routes) }
|
||||
end
|
||||
|
||||
context 'without :routes' do
|
||||
its(:routes) { should == [] }
|
||||
it { expect(subject.routes).to eq([]) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1504,12 +1504,12 @@ describe Msf::DBManager do
|
|||
update_module_details
|
||||
end
|
||||
|
||||
its(:mtype) { should == module_type }
|
||||
its(:privileged) { should == privileged }
|
||||
its(:rank) { should == rank }
|
||||
its(:ready) { should == true }
|
||||
its(:refname) { should == module_reference_name }
|
||||
its(:stance) { should == stance }
|
||||
it { expect(subject.mtype).to eq(module_type) }
|
||||
it { expect(subject.privileged).to eq(privileged) }
|
||||
it { expect(subject.rank).to eq(rank) }
|
||||
it { expect(subject.ready).to be_truthy }
|
||||
it { expect(subject.refname).to eq(module_reference_name) }
|
||||
it { expect(subject.stance).to eq(stance) }
|
||||
end
|
||||
|
||||
context 'with :bits' do
|
||||
|
@ -1554,7 +1554,7 @@ describe Msf::DBManager do
|
|||
update_module_details
|
||||
end
|
||||
|
||||
its(:name) { should == name }
|
||||
it { expect(subject.name).to eq(name) }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1591,7 +1591,7 @@ describe Msf::DBManager do
|
|||
update_module_details
|
||||
end
|
||||
|
||||
its(:name) { should == name }
|
||||
it { expect(subject.name).to eq(name) }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1633,8 +1633,8 @@ describe Msf::DBManager do
|
|||
update_module_details
|
||||
end
|
||||
|
||||
its(:name) { should == name }
|
||||
its(:email) { should == email }
|
||||
it { expect(subject.name).to eq(name) }
|
||||
it { expect(subject.email).to eq(email) }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1671,7 +1671,7 @@ describe Msf::DBManager do
|
|||
update_module_details
|
||||
end
|
||||
|
||||
its(:name) { should == name }
|
||||
it { expect(subject.name).to eq(name) }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1708,7 +1708,7 @@ describe Msf::DBManager do
|
|||
update_module_details
|
||||
end
|
||||
|
||||
its(:name) { should == name }
|
||||
it { expect(subject.name).to eq(name) }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1750,8 +1750,8 @@ describe Msf::DBManager do
|
|||
update_module_details
|
||||
end
|
||||
|
||||
its(:index) { should == index }
|
||||
its(:name) { should == name }
|
||||
it { expect(subject.index).to eq(index) }
|
||||
it { expect(subject.name).to eq(name) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -129,7 +129,7 @@ describe Msf::Ui::Console::CommandDispatcher::Db do
|
|||
FactoryGirl.create(:mdm_service, :host => host, :port => 1026)
|
||||
end
|
||||
it "should list services that are not on a given port" do
|
||||
pending("refs redmine ticket #4821") {
|
||||
skip("refs redmine ticket #4821") {
|
||||
db.cmd_services "-np", "1024"
|
||||
|
||||
@output.should =~ [
|
||||
|
|
|
@ -57,8 +57,8 @@ describe Msf::Util::EXE do
|
|||
fmt = format_hash[:format]
|
||||
arch = format_hash[:arch]
|
||||
|
||||
if format_hash[:pending]
|
||||
pending "returns an executable when given arch=#{arch}, fmt=#{fmt}"
|
||||
if format_hash[:skip]
|
||||
skip "returns an executable when given arch=#{arch}, fmt=#{fmt}"
|
||||
next
|
||||
end
|
||||
|
||||
|
|
|
@ -209,7 +209,7 @@ lots \t of whitespace
|
|||
subject_no_literal.code.should be
|
||||
subject_no_literal.code.should be_kind_of String
|
||||
subject_no_literal.code.include?('Find-4624Logons').should be_falsey
|
||||
subject_no_literal.code.include?('lots of whitespace').should be_true
|
||||
subject_no_literal.code.include?('lots of whitespace').should be_truthy
|
||||
subject_no_literal.code.include?('$kernel32').should be_falsey
|
||||
subject_no_literal.code.include?('comment').should be_falsey
|
||||
res = (subject_no_literal.code =~ /\r\n\r\n/)
|
||||
|
|
|
@ -22,7 +22,7 @@ describe Rex::Exploitation::Powershell::Output do
|
|||
subject.code.should be
|
||||
subject.code.should be_kind_of String
|
||||
subject.code.empty?.should be_falsey
|
||||
subject.functions.empty?.should be_true
|
||||
subject.functions.empty?.should be_truthy
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ DumpHashes"""
|
|||
it 'should substitute values in script' do
|
||||
script = described_class.make_subs(example_script,[['BitConverter','ParpConverter']])
|
||||
script.include?('BitConverter').should be_falsey
|
||||
script.include?('ParpConverter').should be_true
|
||||
script.include?('ParpConverter').should be_truthy
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -230,17 +230,17 @@ describe Rex::Post::Meterpreter::GroupTlv do
|
|||
end
|
||||
|
||||
it "should raise an error when given something other than nil or an array" do
|
||||
pending "RM #7598"
|
||||
skip "RM #7598"
|
||||
group_tlv.add_tlvs("bad value").should raise_error
|
||||
end
|
||||
|
||||
it "should raise an error when given an array of objects other than hashes" do
|
||||
pending "RM #7598"
|
||||
skip "RM #7598"
|
||||
group_tlv.add_tlvs([1,2,3]).should raise_error
|
||||
end
|
||||
|
||||
it "should raise an error when any of the hashes are missing a key" do
|
||||
pending "RM #7598"
|
||||
skip "RM #7598"
|
||||
tlv_array = [
|
||||
{:type => Rex::Post::Meterpreter::TLV_TYPE_STRING, :value => "test"},
|
||||
{:type => Rex::Post::Meterpreter::TLV_TYPE_STRING}
|
||||
|
|
|
@ -156,27 +156,27 @@ describe Rex::Proto::Http::Client do
|
|||
cli.close.should be_nil
|
||||
end
|
||||
|
||||
it "should send a request and receive a response", :pending => excuse_needs_connection do
|
||||
it "should send a request and receive a response", :skip => excuse_needs_connection do
|
||||
|
||||
end
|
||||
|
||||
it "should send a request and receive a response without auth handling", :pending => excuse_needs_connection do
|
||||
it "should send a request and receive a response without auth handling", :skip => excuse_needs_connection do
|
||||
|
||||
end
|
||||
|
||||
it "should send a request", :pending => excuse_needs_connection do
|
||||
it "should send a request", :skip => excuse_needs_connection do
|
||||
|
||||
end
|
||||
|
||||
it "should test for credentials" do
|
||||
pending "Should actually respond to :has_creds" do
|
||||
skip "Should actually respond to :has_creds" do
|
||||
cli.should_not have_creds
|
||||
this_cli = described_class.new("127.0.0.1", 1, {}, false, nil, nil, "user1", "pass1" )
|
||||
this_cli.should have_creds
|
||||
end
|
||||
end
|
||||
|
||||
it "should send authentication", :pending => excuse_needs_connection
|
||||
it "should send authentication", :skip => excuse_needs_connection
|
||||
|
||||
it "should produce a basic authentication header" do
|
||||
u = "user1"
|
||||
|
@ -185,15 +185,15 @@ describe Rex::Proto::Http::Client do
|
|||
cli.basic_auth_header("user1","pass1").should == "Basic #{b64}"
|
||||
end
|
||||
|
||||
it "should perform digest authentication", :pending => excuse_needs_auth do
|
||||
it "should perform digest authentication", :skip => excuse_needs_auth do
|
||||
|
||||
end
|
||||
|
||||
it "should perform negotiate authentication", :pending => excuse_needs_auth do
|
||||
it "should perform negotiate authentication", :skip => excuse_needs_auth do
|
||||
|
||||
end
|
||||
|
||||
it "should get a response", :pending => excuse_needs_connection do
|
||||
it "should get a response", :skip => excuse_needs_connection do
|
||||
|
||||
end
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ describe Rex::Proto::PJL::Client do
|
|||
|
||||
context "#initialize" do
|
||||
it "should initialize a 'sock' ivar" do
|
||||
cli.instance_variable_get(:@sock).class.should eq(RSpec::Mocks::Mock)
|
||||
cli.instance_variable_get(:@sock).class.should eq(RSpec::Mocks::Double)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -15,13 +15,13 @@ describe Rex::Socket::RangeWalker do
|
|||
context "with a hostname" do
|
||||
let(:args) { "localhost" }
|
||||
it { should be_valid }
|
||||
it { should have_at_least(1).address }
|
||||
it { expect(subject.length).to be >= 1 }
|
||||
end
|
||||
|
||||
context "with a hostname and CIDR" do
|
||||
let(:args) { "localhost/24" }
|
||||
it { should be_valid }
|
||||
it { should have(256).addresses }
|
||||
it { expect(subject.length).to eq(256) }
|
||||
end
|
||||
|
||||
context "with an invalid hostname" do
|
||||
|
@ -55,7 +55,7 @@ describe Rex::Socket::RangeWalker do
|
|||
context "with mulitple ranges" do
|
||||
let(:args) { "1.1.1.1-2 2.1-2.2.2 3.1-2.1-2.1 " }
|
||||
it { should be_valid }
|
||||
it { should have(8).addresses }
|
||||
it { expect(subject.length).to eq(8) }
|
||||
it { should include("1.1.1.1") }
|
||||
end
|
||||
|
||||
|
|
|
@ -39,8 +39,8 @@ describe Rex::Socket do
|
|||
|
||||
context 'with ipv6' do
|
||||
let(:try) { "fe80::1" }
|
||||
it { should be_a(String) }
|
||||
it { should have(16).bytes }
|
||||
it { is_expected.to be_an(String) }
|
||||
it { expect(subject.bytes.count).to eq(16) }
|
||||
it "should be in the right order" do
|
||||
nbo.should == "\xfe\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01"
|
||||
end
|
||||
|
@ -48,8 +48,8 @@ describe Rex::Socket do
|
|||
|
||||
context 'with ipv4' do
|
||||
let(:try) { "127.0.0.1" }
|
||||
it { should be_a(String) }
|
||||
it { should have(4).bytes }
|
||||
it { is_expected.to be_an(String) }
|
||||
it { expect(subject.bytes.count).to eq(4) }
|
||||
it "should be in the right order" do
|
||||
nbo.should == "\x7f\x00\x00\x01"
|
||||
end
|
||||
|
@ -131,8 +131,8 @@ describe Rex::Socket do
|
|||
let(:response_afamily) { Socket::AF_INET }
|
||||
let(:response_addresses) { ["\x01\x01\x01\x01", "\x02\x02\x02\x02"] }
|
||||
|
||||
it { should be_a(Array) }
|
||||
it { should have(2).addresses }
|
||||
it { is_expected.to be_an(Array) }
|
||||
it { expect(subject.size).to eq(2) }
|
||||
it "should return the ASCII addresses" do
|
||||
subject.should include("1.1.1.1")
|
||||
subject.should include("2.2.2.2")
|
||||
|
@ -143,8 +143,8 @@ describe Rex::Socket do
|
|||
let(:response_afamily) { Socket::AF_INET6 }
|
||||
let(:response_addresses) { ["\xfe\x80"+("\x00"*13)+"\x01", "\xfe\x80"+("\x00"*13)+"\x02"] }
|
||||
|
||||
it { should be_a(Array) }
|
||||
it { should have(2).addresses }
|
||||
it { is_expected.to be_an(Array) }
|
||||
it { expect(subject.size).to eq(2) }
|
||||
it "should return the ASCII addresses" do
|
||||
subject.should include("fe80::1")
|
||||
subject.should include("fe80::2")
|
||||
|
@ -155,8 +155,8 @@ describe Rex::Socket do
|
|||
let(:response_afamily) { Socket::AF_INET }
|
||||
let(:response_addresses) { ["1.1.1.1", "2.2.2.2"] }
|
||||
|
||||
it { should be_a(Array) }
|
||||
it { should have(2).addresses }
|
||||
it { is_expected.to be_an(Array) }
|
||||
it { expect(subject.size).to eq(2) }
|
||||
it "should return the ASCII addresses" do
|
||||
subject.should include("1.1.1.1")
|
||||
subject.should include("2.2.2.2")
|
||||
|
|
|
@ -188,9 +188,9 @@ describe Msfupdate do
|
|||
context "in an apt installation" do
|
||||
let(:msfbase_dir) { dummy_apt_pathname }
|
||||
|
||||
its(:apt?) { should == true }
|
||||
its(:binary_install?) { should == false }
|
||||
its(:git?) { should == false }
|
||||
it { expect(subject.apt?).to be_truthy }
|
||||
it { expect(subject.binary_install?).to be_falsey }
|
||||
it { expect(subject.git?).to be_falsey }
|
||||
|
||||
context "#validate_args" do
|
||||
before(:each) do
|
||||
|
@ -199,22 +199,22 @@ describe Msfupdate do
|
|||
|
||||
context "with no args" do
|
||||
let(:args) { [] }
|
||||
its(:validate_args) { should == true }
|
||||
it { expect(subject.validate_args).to be_truthy }
|
||||
end
|
||||
|
||||
context "with --git-remote" do
|
||||
let(:args) { ['--git-remote', 'foo'] }
|
||||
its(:validate_args) { should == false }
|
||||
it { expect(subject.validate_args).to be_falsey }
|
||||
end
|
||||
|
||||
context "with --git-branch" do
|
||||
let(:args) { ['--git-branch', 'foo'] }
|
||||
its(:validate_args) { should == false }
|
||||
it { expect(subject.validate_args).to be_falsey }
|
||||
end
|
||||
|
||||
context "with --offline-file" do
|
||||
let(:args) { ['--offline-file', 'foo'] }
|
||||
its(:validate_args) { should == false }
|
||||
it { expect(subject.validate_args).to be_falsey }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -241,9 +241,9 @@ describe Msfupdate do
|
|||
context "in a binary installation" do
|
||||
let(:msfbase_dir) { dummy_install_pathname }
|
||||
|
||||
its(:apt?) { should == false }
|
||||
its(:binary_install?) { should == true }
|
||||
its(:git?) { should == false }
|
||||
it { expect(subject.apt?).to be_falsey }
|
||||
it { expect(subject.binary_install?).to be_truthy }
|
||||
it { expect(subject.git?).to be_falsey }
|
||||
|
||||
context "#validate_args" do
|
||||
before(:each) do
|
||||
|
@ -252,22 +252,22 @@ describe Msfupdate do
|
|||
|
||||
context "with no args" do
|
||||
let(:args) { [] }
|
||||
its(:validate_args) { should == true }
|
||||
it { expect(subject.validate_args).to be_truthy }
|
||||
end
|
||||
|
||||
context "with --git-remote" do
|
||||
let(:args) { ['--git-remote', 'foo'] }
|
||||
its(:validate_args) { should == false }
|
||||
it { expect(subject.validate_args).to be_falsey }
|
||||
end
|
||||
|
||||
context "with --git-branch" do
|
||||
let(:args) { ['--git-branch', 'foo'] }
|
||||
its(:validate_args) { should == false }
|
||||
it { expect(subject.validate_args).to be_falsey }
|
||||
end
|
||||
|
||||
context "with --offline-file" do
|
||||
let(:args) { ['--offline-file', 'foo'] }
|
||||
its(:validate_args) { should == true }
|
||||
it { expect(subject.validate_args).to be_truthy }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -294,9 +294,10 @@ describe Msfupdate do
|
|||
context "in a git installation" do
|
||||
let(:msfbase_dir) { dummy_git_pathname }
|
||||
|
||||
its(:apt?) { should == false }
|
||||
its(:binary_install?) { should == false }
|
||||
its(:git?) { should == true }
|
||||
it { expect(subject.apt?).to be_falsey }
|
||||
it { expect(subject.binary_install?).to be_falsey }
|
||||
it { expect(subject.git?).to be_truthy }
|
||||
|
||||
|
||||
context "#validate_args" do
|
||||
before(:each) do
|
||||
|
@ -305,22 +306,22 @@ describe Msfupdate do
|
|||
|
||||
context "with no args" do
|
||||
let(:args) { [] }
|
||||
its(:validate_args) { should == true }
|
||||
it { expect(subject.validate_args).to be_truthy }
|
||||
end
|
||||
|
||||
context "with --git-remote" do
|
||||
let(:args) { ['--git-remote', 'foo'] }
|
||||
its(:validate_args) { should == true }
|
||||
it { expect(subject.validate_args).to be_truthy }
|
||||
end
|
||||
|
||||
context "with --git-branch" do
|
||||
let(:args) { ['--git-branch', 'foo'] }
|
||||
its(:validate_args) { should == true }
|
||||
it { expect(subject.validate_args).to be_truthy }
|
||||
end
|
||||
|
||||
context "with --offline-file" do
|
||||
let(:args) { ['--offline-file', 'foo'] }
|
||||
its(:validate_args) { should == false }
|
||||
it { expect(subject.validate_args).to be_falsey }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -403,10 +403,10 @@ shared_examples_for 'Msf::ModuleManager::Cache' do
|
|||
module_info_by_path_from_database!
|
||||
end
|
||||
|
||||
its([:modification_time]) { should be_within(1.second).of(pathname_modification_time) }
|
||||
its([:parent_path]) { should == parent_path }
|
||||
its([:reference_name]) { should == reference_name }
|
||||
its([:type]) { should == type }
|
||||
it { expect(subject[:modification_time]).to be_within(1.second).of(pathname_modification_time) }
|
||||
it { expect(subject[:parent_path]).to eq(parent_path) }
|
||||
it { expect(subject[:reference_name]).to eq(reference_name) }
|
||||
it { expect(subject[:type]).to eq(type) }
|
||||
end
|
||||
|
||||
context 'typed module set' do
|
||||
|
|
|
@ -42,7 +42,7 @@ shared_examples_for 'Msf::ModuleManager::Loading' do
|
|||
tempfile.unlink
|
||||
|
||||
File.exist?(module_path).should be_falsey
|
||||
subject.file_changed?(module_path).should be_true
|
||||
subject.file_changed?(module_path).should be_truthy
|
||||
end
|
||||
|
||||
it 'should return true if modification time does not match the cached modification time' do
|
||||
|
|
|
@ -34,8 +34,8 @@ shared_examples_for "an option" do |valid_values, invalid_values, type|
|
|||
subject.normalize(valid_value).should == normalized_value
|
||||
subject.valid?(valid_value).should be_truthy
|
||||
}
|
||||
if vhash[:pending]
|
||||
pending(vhash[:pending], &block)
|
||||
if vhash[:skip]
|
||||
skip(vhash[:skip], &block)
|
||||
else
|
||||
block.call
|
||||
end
|
||||
|
@ -48,8 +48,8 @@ shared_examples_for "an option" do |valid_values, invalid_values, type|
|
|||
invalid_value = vhash[:value]
|
||||
it "should not be valid: #{invalid_value}" do
|
||||
block = Proc.new { subject.valid?(invalid_value).should be_falsey }
|
||||
if vhash[:pending]
|
||||
pending(vhash[:pending], &block)
|
||||
if vhash[:skip]
|
||||
skip(vhash[:skip], &block)
|
||||
else
|
||||
block.call
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue