Show command when remote execution fail

This commit is contained in:
Thibault Jouan
2014-05-25 15:51:33 +00:00
parent 8168e68a2d
commit 0db2d90b72
6 changed files with 61 additions and 19 deletions

View File

@@ -106,14 +106,23 @@ module Producer::Core
expect(output.string).to eq arguments
end
it 'raises an exception when the exit status code is not 0' do
story_with_new_channel do |ch|
ch.sends_exec command
ch.gets_data arguments
ch.gets_exit_status 1
context 'when command execution fails' do
before do
story_with_new_channel do |ch|
ch.sends_exec command
ch.gets_data arguments
ch.gets_exit_status 1
end
end
it 'raises an exception' do
expect { remote.execute command }
.to raise_error(RemoteCommandExecutionError)
end
it 'includes the command in the exception message' do
expect { remote.execute command }.to raise_error /#{command}/
end
expect { remote.execute command }
.to raise_error(RemoteCommandExecutionError)
end
end