Red rank_modules ranks unloadable as Manual

MSP-12557
bug/bundler_fix
Luke Imhoff 2015-04-15 16:09:19 -05:00
parent 87d1770bac
commit 16234feeed
No known key found for this signature in database
GPG Key ID: 5B1FB01FB33356F8
1 changed files with 32 additions and 9 deletions

View File

@ -22,9 +22,30 @@ RSpec.describe Msf::ModuleSet do
end
context 'create' do
#
# lets
#
let(:b_class) {
Class.new
}
let(:c_class) {
Class.new
}
context 'returns nil' do
before(:each) do
allow(module_set).to receive(:create).and_return(nil)
hide_const('A::Rank')
allow(module_set).to receive(:create).with('a').and_return(nil)
stub_const('B', b_class)
stub_const('B::Rank', Msf::LowRanking)
allow(module_set).to receive(:create).with('b').and_return(b_class.new)
stub_const('C', c_class)
stub_const('C::Rank', Msf::AverageRanking)
allow(module_set).to receive(:create).with('c').and_return(c_class.new)
end
specify {
@ -32,6 +53,16 @@ RSpec.describe Msf::ModuleSet do
rank_modules
}.not_to raise_error
}
it 'is ranked as Manual' do
expect(rank_modules).to eq(
[
['c', Msf::SymbolicModule],
['b', Msf::SymbolicModule],
['a', Msf::SymbolicModule]
]
)
end
end
context 'does not return nil' do
@ -43,14 +74,6 @@ RSpec.describe Msf::ModuleSet do
Class.new
}
let(:b_class) {
Class.new
}
let(:c_class) {
Class.new
}
#
# Callbacks
#