Skip to content

Commit 16234fe

Browse files
committed
Red rank_modules ranks unloadable as Manual
MSP-12557
1 parent 87d1770 commit 16234fe

File tree

1 file changed

+32
-9
lines changed

1 file changed

+32
-9
lines changed

spec/lib/msf/core/module_set_spec.rb

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,47 @@
2222
end
2323

2424
context 'create' do
25+
#
26+
# lets
27+
#
28+
29+
let(:b_class) {
30+
Class.new
31+
}
32+
33+
let(:c_class) {
34+
Class.new
35+
}
36+
2537
context 'returns nil' do
2638
before(:each) do
27-
allow(module_set).to receive(:create).and_return(nil)
39+
hide_const('A::Rank')
40+
allow(module_set).to receive(:create).with('a').and_return(nil)
41+
42+
stub_const('B', b_class)
43+
stub_const('B::Rank', Msf::LowRanking)
44+
allow(module_set).to receive(:create).with('b').and_return(b_class.new)
45+
46+
stub_const('C', c_class)
47+
stub_const('C::Rank', Msf::AverageRanking)
48+
allow(module_set).to receive(:create).with('c').and_return(c_class.new)
2849
end
2950

3051
specify {
3152
expect {
3253
rank_modules
3354
}.not_to raise_error
3455
}
56+
57+
it 'is ranked as Manual' do
58+
expect(rank_modules).to eq(
59+
[
60+
['c', Msf::SymbolicModule],
61+
['b', Msf::SymbolicModule],
62+
['a', Msf::SymbolicModule]
63+
]
64+
)
65+
end
3566
end
3667

3768
context 'does not return nil' do
@@ -43,14 +74,6 @@
4374
Class.new
4475
}
4576

46-
let(:b_class) {
47-
Class.new
48-
}
49-
50-
let(:c_class) {
51-
Class.new
52-
}
53-
5477
#
5578
# Callbacks
5679
#

0 commit comments

Comments
 (0)