run rubocop -a on new files

This commit is contained in:
dwelch-r7 2020-03-12 11:48:46 +00:00 committed by Alan Foster
parent 754b42f9f2
commit 55bd3f45be
No known key found for this signature in database
GPG Key ID: 3BD4FA3818818F04
1 changed files with 15 additions and 18 deletions

View File

@ -3,14 +3,12 @@ require 'spec_helper'
require 'msf/core/rpc/v10/rpc_job_status_tracker'
RSpec.describe RpcJobStatusTracker do
context "With default options" do
context 'With default options' do
let(:job_status_tracker) { described_class.new }
let(:job_id) { "super_random_job_id" }
let(:job_id) { 'super_random_job_id' }
let(:good_result) { 'yay_success' }
let(:bad_result) { 'boo_fail' }
let(:mod) { double("mod") }
let(:mod) { double('mod') }
context 'A job is waiting' do
before(:each) do
@ -32,7 +30,7 @@ RSpec.describe RpcJobStatusTracker do
expect(job_status_tracker.result_ids).to eql([])
end
context "The job is started" do
context 'The job is started' do
before(:each) do
job_status_tracker.start(job_id)
end
@ -52,7 +50,7 @@ RSpec.describe RpcJobStatusTracker do
expect(job_status_tracker.result_ids).to eql([])
end
context "The job completes successfully" do
context 'The job completes successfully' do
before(:each) do
job_status_tracker.completed(job_id, good_result, mod)
end
@ -73,10 +71,10 @@ RSpec.describe RpcJobStatusTracker do
end
it 'should have a retrievable result' do
expect(job_status_tracker.result job_id).to eql({"result" => good_result})
expect(job_status_tracker.result(job_id)).to eql({ 'result' => good_result })
end
context "The job is acknowledged" do
context 'The job is acknowledged' do
before(:each) do
job_status_tracker.ack(job_id)
end
@ -98,7 +96,7 @@ RSpec.describe RpcJobStatusTracker do
end
end
context "The job fails" do
context 'The job fails' do
before(:each) do
job_status_tracker.failed(job_id, bad_result, mod)
end
@ -119,10 +117,10 @@ RSpec.describe RpcJobStatusTracker do
end
it 'should have a retrievable result' do
expect(job_status_tracker.result job_id).to eql({"error" => bad_result})
expect(job_status_tracker.result(job_id)).to eql({ 'error' => bad_result })
end
context "The job is acknowledged" do
context 'The job is acknowledged' do
before(:each) do
job_status_tracker.ack(job_id)
end
@ -145,9 +143,9 @@ RSpec.describe RpcJobStatusTracker do
end
context 'The job result is not serializable' do
let(:mock_result) { {mock: "result"} }
let(:mock_result) { { mock: 'result' } }
before(:each) do
allow(mod).to receive(:fullname).and_return("module_name")
allow(mod).to receive(:fullname).and_return('module_name')
allow(job_status_tracker.instance_variable_get(:@results)).to receive(:write).with(job_id, mock_result.to_json).and_raise Exception, 'Intentional explosion'
allow(job_status_tracker.instance_variable_get(:@results)).to receive(:write).with(job_id, /error/).and_call_original
@ -162,12 +160,11 @@ RSpec.describe RpcJobStatusTracker do
it 'should have an error result' do
puts job_status_tracker.result job_id
expect(job_status_tracker.result job_id).to have_key("error")
expect(job_status_tracker.result job_id).to have_key("data")
expect(job_status_tracker.result(job_id)).to have_key('error')
expect(job_status_tracker.result(job_id)).to have_key('data')
end
end
end
end
end
end
end