Implement Testing::MockRemote#execute

This commit is contained in:
Thibault Jouan
2014-03-04 05:40:13 +00:00
parent b576604498
commit 85e3bf2eac
2 changed files with 41 additions and 0 deletions

View File

@@ -1,3 +1,4 @@
require 'spec_helper'
require 'producer/core/testing'
module Producer::Core
@@ -14,6 +15,32 @@ module Producer::Core
expect { remote.session }.to raise_error
end
end
describe '#execute' do
context 'dummy echo command' do
let(:command) { 'echo some arguments' }
it 'returns command arguments' do
expect(remote.execute(command)).to eq 'some arguments'
end
end
context 'dummy true command' do
let(:command) { 'true' }
it 'returns an empty string' do
expect(remote.execute(command)).to eq ''
end
end
context 'dummy false command' do
let(:command) { 'false' }
it 'raises a RemoteCommandExecutionError' do
expect { remote.execute(command) }.to raise_error(RemoteCommandExecutionError)
end
end
end
end
end
end