Files
metasploit-gs/spec/tools/dev/msftidy_spec.rb
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

35 lines
1.2 KiB
Ruby
Raw Normal View History

require 'spec_helper'
2021-01-29 17:59:14 +00:00
require Metasploit::Framework.root.join('tools/dev/msftidy.rb').to_path
RSpec.describe Msftidy do
2021-01-29 17:59:14 +00:00
let(:file) { File.expand_path('modules/auxiliary/auxiliary_rubocopped.rb', FILE_FIXTURES_PATH) }
before(:each) do
allow_any_instance_of(MsftidyRunner).to receive(:run_checks)
allow_any_instance_of(MsftidyRunner).to receive(:status).and_return(msftidy_runner_status_code)
allow_any_instance_of(RuboCopRunner).to receive(:run).and_return(rubocop_runner_status_code)
end
2021-01-29 17:59:14 +00:00
context 'when there are no errors' do
let(:msftidy_runner_status_code) { MsftidyRunner::OK }
let(:rubocop_runner_status_code) { RuboCop::CLI::STATUS_SUCCESS }
2021-01-29 17:59:14 +00:00
it { expect(subject.run([file])).to eql MsftidyRunner::OK }
end
2021-01-29 17:59:14 +00:00
context 'when there are msftidy errors' do
let(:msftidy_runner_status_code) { MsftidyRunner::WARNING }
let(:rubocop_runner_status_code) { RuboCop::CLI::STATUS_SUCCESS }
2021-01-29 17:59:14 +00:00
it { expect(subject.run([file])).to eql MsftidyRunner::WARNING }
end
2021-01-29 17:59:14 +00:00
context 'when there are rubcop errors' do
let(:msftidy_runner_status_code) { MsftidyRunner::WARNING }
let(:rubocop_runner_status_code) { RuboCop::CLI::STATUS_ERROR }
2021-01-29 17:59:14 +00:00
it { expect(subject.run([file])).to eql MsftidyRunner::ERROR }
end
end