Path: blob/master/spec/tools/dev/msftidy_spec.rb
19591 views
require 'spec_helper'12require Metasploit::Framework.root.join('tools/dev/msftidy.rb').to_path34RSpec.describe Msftidy do5let(:file) { File.expand_path('modules/auxiliary/auxiliary_rubocopped.rb', FILE_FIXTURES_PATH) }67before(:each) do8allow_any_instance_of(MsftidyRunner).to receive(:run_checks)9allow_any_instance_of(MsftidyRunner).to receive(:status).and_return(msftidy_runner_status_code)10allow_any_instance_of(RuboCopRunner).to receive(:run).and_return(rubocop_runner_status_code)11end1213context 'when there are no errors' do14let(:msftidy_runner_status_code) { MsftidyRunner::OK }15let(:rubocop_runner_status_code) { RuboCop::CLI::STATUS_SUCCESS }1617it { expect(subject.run([file])).to eql MsftidyRunner::OK }18end1920context 'when there are msftidy errors' do21let(:msftidy_runner_status_code) { MsftidyRunner::WARNING }22let(:rubocop_runner_status_code) { RuboCop::CLI::STATUS_SUCCESS }2324it { expect(subject.run([file])).to eql MsftidyRunner::WARNING }25end2627context 'when there are rubcop errors' do28let(:msftidy_runner_status_code) { MsftidyRunner::WARNING }29let(:rubocop_runner_status_code) { RuboCop::CLI::STATUS_ERROR }3031it { expect(subject.run([file])).to eql MsftidyRunner::ERROR }32end33end343536