Implement Remote::FS#sftp
This commit is contained in:
parent
d240df0281
commit
99710b0df9
@ -7,6 +7,10 @@ module Producer
|
|||||||
def initialize(remote)
|
def initialize(remote)
|
||||||
@remote = remote
|
@remote = remote
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def sftp
|
||||||
|
@sftp ||= @remote.session.sftp.connect
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -10,5 +10,25 @@ module Producer::Core
|
|||||||
expect(fs.instance_eval { @remote }).to be remote
|
expect(fs.instance_eval { @remote }).to be remote
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe '#sftp', :ssh do
|
||||||
|
before { sftp_story }
|
||||||
|
|
||||||
|
it 'builds a new SFTP session' do
|
||||||
|
expect(remote.session.sftp).to receive(:connect)
|
||||||
|
fs.sftp
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'returns the new SFTP session' do
|
||||||
|
session = double('session')
|
||||||
|
allow(remote.session.sftp).to receive(:connect) { session }
|
||||||
|
expect(fs.sftp).to be session
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'memoizes the FS' do
|
||||||
|
allow(remote.session.sftp).to receive(:connect) { Object.new }
|
||||||
|
expect(fs.sftp).to be fs.sftp
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user