Skip to content

Commit 2a3ed89

Browse files
committed
Add specs for Msf::Opt
1 parent b64d881 commit 2a3ed89

File tree

1 file changed

+112
-0
lines changed

1 file changed

+112
-0
lines changed

spec/lib/msf/core/opt_spec.rb

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
2+
describe Msf::Opt do
3+
subject(:opt) { described_class }
4+
5+
it { is_expected.to respond_to(:CHOST) }
6+
it { is_expected.to respond_to(:CPORT) }
7+
it { is_expected.to respond_to(:LHOST) }
8+
it { is_expected.to respond_to(:LPORT) }
9+
it { is_expected.to respond_to(:Proxies) }
10+
it { is_expected.to respond_to(:RHOST) }
11+
it { is_expected.to respond_to(:RPORT) }
12+
13+
context 'constants' do
14+
context 'CHOST' do
15+
subject { described_class::CHOST }
16+
it { is_expected.to be_a(Msf::OptAddress) }
17+
end
18+
19+
context 'CPORT' do
20+
subject { described_class::CPORT }
21+
it { is_expected.to be_a(Msf::OptPort) }
22+
end
23+
24+
context 'LHOST' do
25+
subject { described_class::LHOST }
26+
it { is_expected.to be_a(Msf::OptAddress) }
27+
end
28+
29+
context 'LPORT' do
30+
subject { described_class::LPORT }
31+
it { is_expected.to be_a(Msf::OptPort) }
32+
end
33+
34+
context 'Proxies' do
35+
subject { described_class::Proxies }
36+
it { is_expected.to be_a(Msf::OptString) }
37+
end
38+
39+
context 'RHOST' do
40+
subject { described_class::RHOST }
41+
it { is_expected.to be_a(Msf::OptAddress) }
42+
end
43+
44+
context 'RPORT' do
45+
subject { described_class::RPORT }
46+
it { is_expected.to be_a(Msf::OptPort) }
47+
end
48+
49+
end
50+
51+
context 'class methods' do
52+
let(:default) { 'foo' }
53+
context 'CHOST()' do
54+
subject { described_class::CHOST(default) }
55+
it { is_expected.to be_a(Msf::OptAddress) }
56+
specify 'sets default' do
57+
expect(subject.default).to eq(default)
58+
end
59+
end
60+
61+
context 'CPORT()' do
62+
subject { described_class::CPORT(default) }
63+
it { is_expected.to be_a(Msf::OptPort) }
64+
specify 'sets default' do
65+
expect(subject.default).to eq(default)
66+
end
67+
end
68+
69+
context 'LHOST()' do
70+
subject { described_class::LHOST(default) }
71+
it { is_expected.to be_a(Msf::OptAddress) }
72+
specify 'sets default' do
73+
expect(subject.default).to eq(default)
74+
end
75+
end
76+
77+
context 'LPORT()' do
78+
subject { described_class::LPORT(default) }
79+
it { is_expected.to be_a(Msf::OptPort) }
80+
specify 'sets default' do
81+
expect(subject.default).to eq(default)
82+
end
83+
end
84+
85+
context 'Proxies()' do
86+
subject { described_class::Proxies(default) }
87+
it { is_expected.to be_a(Msf::OptString) }
88+
specify 'sets default' do
89+
expect(subject.default).to eq(default)
90+
end
91+
end
92+
93+
context 'RHOST()' do
94+
subject { described_class::RHOST(default) }
95+
it { is_expected.to be_a(Msf::OptAddress) }
96+
specify 'sets default' do
97+
expect(subject.default).to eq(default)
98+
end
99+
end
100+
101+
context 'RPORT()' do
102+
subject { described_class::RPORT(default) }
103+
it { is_expected.to be_a(Msf::OptPort) }
104+
specify 'sets default' do
105+
expect(subject.default).to eq(default)
106+
end
107+
end
108+
109+
end
110+
111+
end
112+

0 commit comments

Comments
 (0)