Skip to content

Commit d57cf8f

Browse files
committed
Green rank_modules with Rank
MSP-12557 Test that modules that need to be loaded are ranked using Rank after loading.
1 parent 4de35e8 commit d57cf8f

File tree

1 file changed

+46
-1
lines changed

1 file changed

+46
-1
lines changed

spec/lib/msf/core/module_set_spec.rb

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,53 @@
3535
end
3636

3737
context 'does not return nil' do
38+
#
39+
# lets
40+
#
41+
42+
let(:a_class) {
43+
Class.new
44+
}
45+
46+
let(:b_class) {
47+
Class.new
48+
}
49+
50+
let(:c_class) {
51+
Class.new
52+
}
53+
54+
#
55+
# Callbacks
56+
#
57+
58+
before(:each) do
59+
allow(module_set).to receive(:create).with('a').and_return(a_class.new)
60+
allow(module_set).to receive(:create).with('b').and_return(b_class.new)
61+
allow(module_set).to receive(:create).with('c').and_return(c_class.new)
62+
end
63+
3864
context 'with Rank' do
39-
it 'is ranked using Rank'
65+
before(:each) do
66+
stub_const('A', a_class)
67+
stub_const('A::Rank', Msf::LowRanking)
68+
69+
stub_const('B', b_class)
70+
stub_const('B::Rank', Msf::AverageRanking)
71+
72+
stub_const('C', c_class)
73+
stub_const('C::Rank', Msf::GoodRanking)
74+
end
75+
76+
it 'is ranked using Rank' do
77+
expect(rank_modules).to eq(
78+
[
79+
['c', Msf::SymbolicModule],
80+
['b', Msf::SymbolicModule],
81+
['a', Msf::SymbolicModule]
82+
]
83+
)
84+
end
4085
end
4186

4287
context 'without Rank' do

0 commit comments

Comments
 (0)