Attach duration information to the exception object

This commit is contained in:
Felix Auringer
2021-06-28 12:03:20 +02:00
committed by Sebastian Serth
parent 36578a2817
commit 2dff81a510
9 changed files with 87 additions and 57 deletions

View File

@ -289,20 +289,10 @@ describe Runner::Strategy::Poseidon do
end
describe '#attach_to_execution' do
# TODO: add more tests here
# TODO: add tests here
let(:command) { 'ls' }
let(:action) { -> { poseidon.attach_to_execution(command) } }
let(:websocket_url) { 'ws://ws.example.com/path/to/websocket' }
it 'returns the execution time' do
allow(poseidon).to receive(:execute_command).with(command).and_return(websocket_url)
allow(EventMachine).to receive(:run)
starting_time = Time.zone.now
execution_time = action.call
test_time = Time.zone.now - starting_time
expect(execution_time).to be_between(0.0, test_time).exclusive
end
end
end