2014-07-15 18:06:53 +00:00
|
|
|
# -*- coding:binary -*-
|
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
require 'rex/post/meterpreter/ui/console'
|
|
|
|
|
2015-10-16 20:57:04 +00:00
|
|
|
RSpec.describe Rex::Post::Meterpreter::Ui::Console do
|
2014-07-15 18:06:53 +00:00
|
|
|
|
|
|
|
subject(:console) do
|
|
|
|
Rex::Post::Meterpreter::Ui::Console.new(nil)
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "#run_command" do
|
|
|
|
let(:dispatcher) do
|
|
|
|
double
|
|
|
|
end
|
|
|
|
|
|
|
|
it "logs error when Rex::AddressInUse is raised" do
|
|
|
|
allow(dispatcher).to receive(:cmd_address_in_use) do
|
|
|
|
raise Rex::AddressInUse, "0.0.0.0:80"
|
|
|
|
end
|
|
|
|
|
|
|
|
expect(subject).to receive(:log_error).with("The address is already in use (0.0.0.0:80).")
|
|
|
|
subject.run_command(dispatcher, "address_in_use", nil)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|