Add support for `type' command in MockRemote

This commit is contained in:
Thibault Jouan 2014-03-05 07:18:50 +00:00
parent b9976464a4
commit aa3694b58c
2 changed files with 26 additions and 0 deletions

View File

@ -17,6 +17,13 @@ module Producer
output << '' output << ''
when 'false' when 'false'
raise RemoteCommandExecutionError raise RemoteCommandExecutionError
when 'type'
raise RemoteCommandExecutionError unless %w[
echo
true
false
type
].include? tokens.first
end end
output output

View File

@ -40,6 +40,25 @@ module Producer::Core
expect { remote.execute(command) }.to raise_error(RemoteCommandExecutionError) expect { remote.execute(command) }.to raise_error(RemoteCommandExecutionError)
end end
end end
context 'dummy type command' do
context 'executable exists' do
let(:command) { 'type true' }
it 'returns an empty string' do
expect(remote.execute(command)).to eq ''
end
end
context 'executable does not exist' do
let(:command) { 'type some_non_existent_executable' }
it 'raises a RemoteCommandExecutionError' do
expect { remote.execute(command) }
.to raise_error(RemoteCommandExecutionError)
end
end
end
end end
end end
end end