CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/spec/lib/rex/post/meterpreter/ui/console.rb
Views: 1904
1
# -*- coding:binary -*-
2
require 'spec_helper'
3
4
require 'rex/post/meterpreter/ui/console'
5
6
RSpec.describe Rex::Post::Meterpreter::Ui::Console do
7
8
subject(:console) do
9
Rex::Post::Meterpreter::Ui::Console.new(nil)
10
end
11
12
describe "#run_command" do
13
let(:dispatcher) do
14
double
15
end
16
17
it "logs error when Rex::AddressInUse is raised" do
18
allow(dispatcher).to receive(:cmd_address_in_use) do
19
raise Rex::AddressInUse, "0.0.0.0:80"
20
end
21
22
expect(subject).to receive(:log_error).with("The address is already in use (0.0.0.0:80).")
23
subject.run_command(dispatcher, "address_in_use", nil)
24
end
25
end
26
27
end
28
29