Skip to content

Commit 4098979

Browse files
committed
Add spec
1 parent 09619ab commit 4098979

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# -*- coding:binary -*-
2+
require 'spec_helper'
3+
4+
require 'rex/post/meterpreter/ui/console'
5+
6+
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

0 commit comments

Comments
 (0)