Implement Remote#fs
This commit is contained in:
parent
99710b0df9
commit
91f2bc3567
@ -14,6 +14,10 @@ module Producer
|
|||||||
@session ||= Net::SSH.start(@hostname, Etc.getlogin)
|
@session ||= Net::SSH.start(@hostname, Etc.getlogin)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def fs
|
||||||
|
@fs ||= Remote::FS.new(self)
|
||||||
|
end
|
||||||
|
|
||||||
def execute(command)
|
def execute(command)
|
||||||
output = ''
|
output = ''
|
||||||
session.open_channel do |channel|
|
session.open_channel do |channel|
|
||||||
|
@ -29,6 +29,24 @@ module Producer::Core
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe '#fs' do
|
||||||
|
it 'builds a new FS' do
|
||||||
|
expect(Remote::FS).to receive(:new)
|
||||||
|
remote.fs
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'returns the new FS instance' do
|
||||||
|
fs = double('fs')
|
||||||
|
allow(Remote::FS).to receive(:new) { fs }
|
||||||
|
expect(remote.fs).to be fs
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'memoizes the FS' do
|
||||||
|
allow(Remote::FS).to receive(:new) { Object.new }
|
||||||
|
expect(remote.fs).to be remote.fs
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe '#execute', :ssh do
|
describe '#execute', :ssh do
|
||||||
let(:arguments) { 'some remote command' }
|
let(:arguments) { 'some remote command' }
|
||||||
let(:command) { "echo #{arguments}" }
|
let(:command) { "echo #{arguments}" }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user