CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/spec/tools/dev/msftidy_runner_spec.rb
Views: 11779
1
require 'spec_helper'
2
3
require Metasploit::Framework.root.join('tools/dev/msftidy.rb').to_path
4
5
RSpec.describe MsftidyRunner do
6
context 'with a tidy auxiliary module' do
7
let(:auxiliary_tidy) { File.expand_path('modules/auxiliary/auxiliary_tidy.rb', FILE_FIXTURES_PATH) }
8
let(:msftidy) { described_class.new(auxiliary_tidy) }
9
10
before(:each) do
11
get_stdout do
12
msftidy.run_checks
13
@msftidy_status = msftidy.status
14
end
15
end
16
17
it 'returns zero (no warnings or errors)' do
18
expect(@msftidy_status).to be_zero
19
end
20
end
21
22
context 'with an untidy auxiliary module' do
23
let(:auxiliary_untidy) { File.expand_path('modules/auxiliary/auxiliary_untidy.rb', FILE_FIXTURES_PATH) }
24
let(:msftidy) { described_class.new(auxiliary_untidy) }
25
26
before(:each) do
27
@msftidy_stdout = get_stdout { msftidy.run_checks }
28
end
29
30
it 'ERRORs when invalid superclass' do
31
expect(@msftidy_stdout).to match(/ERROR.+Invalid super class for auxiliary module/)
32
end
33
34
it 'WARNINGs when specifying Rank' do
35
expect(@msftidy_stdout).to match(/WARNING.+Rank/)
36
end
37
end
38
39
context 'with a tidy payload module' do
40
let(:payload_tidy) { File.expand_path('modules/payloads/payload_tidy.rb', FILE_FIXTURES_PATH) }
41
let(:msftidy) { described_class.new(payload_tidy) }
42
43
before(:each) do
44
get_stdout do
45
msftidy.run_checks
46
@msftidy_status = msftidy.status
47
end
48
end
49
50
it 'returns zero (no warnings or errors)' do
51
expect(@msftidy_status).to be_zero
52
end
53
end
54
end
55
56