2015-12-24 18:55:13 +00:00
|
|
|
require 'spec_helper'
|
2015-12-23 20:53:12 +00:00
|
|
|
|
2015-12-24 18:55:13 +00:00
|
|
|
load Metasploit::Framework.root.join('tools/dev/msftidy.rb').to_path
|
2015-12-23 20:53:12 +00:00
|
|
|
|
2015-12-24 18:55:13 +00:00
|
|
|
RSpec.describe Msftidy do
|
2015-12-23 20:53:12 +00:00
|
|
|
context "with a tidy auxiliary module" do
|
|
|
|
let(:auxiliary_tidy) { File.expand_path('modules/auxiliary/auxiliary_tidy.rb', FILE_FIXTURES_PATH) }
|
2015-12-24 18:55:13 +00:00
|
|
|
let(:msftidy) { Msftidy.new(auxiliary_tidy) }
|
|
|
|
|
|
|
|
before(:each) do
|
2018-07-17 23:19:09 +00:00
|
|
|
msftidy.run_checks
|
|
|
|
@msftidy_status = msftidy.status
|
2015-12-24 18:55:13 +00:00
|
|
|
end
|
2015-12-23 20:53:12 +00:00
|
|
|
|
2018-07-17 23:19:09 +00:00
|
|
|
it "returns zero (no warnings or errors)" do
|
|
|
|
expect(@msftidy_status).to be_zero
|
2015-12-23 20:53:12 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context "with an untidy auxiliary module" do
|
|
|
|
let(:auxiliary_untidy) { File.expand_path('modules/auxiliary/auxiliary_untidy.rb', FILE_FIXTURES_PATH) }
|
2015-12-24 18:55:13 +00:00
|
|
|
let(:msftidy) { Msftidy.new(auxiliary_untidy) }
|
|
|
|
|
|
|
|
before(:each) do
|
|
|
|
@msftidy_stdout = get_stdout { msftidy.run_checks }
|
|
|
|
end
|
2015-12-23 20:53:12 +00:00
|
|
|
|
2015-12-24 18:55:13 +00:00
|
|
|
it "ERRORs when invalid superclass" do
|
|
|
|
expect(@msftidy_stdout).to match(/ERROR.*Invalid super class for auxiliary module/)
|
|
|
|
end
|
|
|
|
|
|
|
|
it "WARNINGs when specifying Rank" do
|
|
|
|
expect(@msftidy_stdout).to match(/WARNING.*Rank/)
|
2015-12-23 20:53:12 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context "with a tidy payload module" do
|
|
|
|
let(:payload_tidy) { File.expand_path('modules/payloads/payload_tidy.rb', FILE_FIXTURES_PATH) }
|
2015-12-24 18:55:13 +00:00
|
|
|
let(:msftidy) { Msftidy.new(payload_tidy) }
|
|
|
|
|
|
|
|
before(:each) do
|
2018-07-17 23:19:09 +00:00
|
|
|
msftidy.run_checks
|
|
|
|
@msftidy_status = msftidy.status
|
2015-12-24 18:55:13 +00:00
|
|
|
end
|
2015-12-23 20:53:12 +00:00
|
|
|
|
2018-07-17 23:19:09 +00:00
|
|
|
it "returns zero (no warnings or errors)" do
|
|
|
|
expect(@msftidy_status).to be_zero
|
2015-12-23 20:53:12 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|