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_spec.rb
Views: 11778
1
require 'spec_helper'
2
3
require Metasploit::Framework.root.join('tools/dev/msftidy.rb').to_path
4
5
RSpec.describe Msftidy do
6
let(:file) { File.expand_path('modules/auxiliary/auxiliary_rubocopped.rb', FILE_FIXTURES_PATH) }
7
8
before(:each) do
9
allow_any_instance_of(MsftidyRunner).to receive(:run_checks)
10
allow_any_instance_of(MsftidyRunner).to receive(:status).and_return(msftidy_runner_status_code)
11
allow_any_instance_of(RuboCopRunner).to receive(:run).and_return(rubocop_runner_status_code)
12
end
13
14
context 'when there are no errors' do
15
let(:msftidy_runner_status_code) { MsftidyRunner::OK }
16
let(:rubocop_runner_status_code) { RuboCop::CLI::STATUS_SUCCESS }
17
18
it { expect(subject.run([file])).to eql MsftidyRunner::OK }
19
end
20
21
context 'when there are msftidy errors' do
22
let(:msftidy_runner_status_code) { MsftidyRunner::WARNING }
23
let(:rubocop_runner_status_code) { RuboCop::CLI::STATUS_SUCCESS }
24
25
it { expect(subject.run([file])).to eql MsftidyRunner::WARNING }
26
end
27
28
context 'when there are rubcop errors' do
29
let(:msftidy_runner_status_code) { MsftidyRunner::WARNING }
30
let(:rubocop_runner_status_code) { RuboCop::CLI::STATUS_ERROR }
31
32
it { expect(subject.run([file])).to eql MsftidyRunner::ERROR }
33
end
34
end
35
36