Rename Remote::FS#{has_,}file?
This commit is contained in:
parent
19b091a15c
commit
103b9d1230
@ -12,7 +12,7 @@ module Producer
|
|||||||
@sftp ||= @remote.session.sftp.connect
|
@sftp ||= @remote.session.sftp.connect
|
||||||
end
|
end
|
||||||
|
|
||||||
def has_file?(path)
|
def file?(path)
|
||||||
sftp.stat!(path).file?
|
sftp.stat!(path).file?
|
||||||
rescue Net::SFTP::StatusException
|
rescue Net::SFTP::StatusException
|
||||||
false
|
false
|
||||||
|
@ -3,7 +3,7 @@ module Producer
|
|||||||
module Tests
|
module Tests
|
||||||
class HasFile < Test
|
class HasFile < Test
|
||||||
def verify
|
def verify
|
||||||
env.remote.fs.has_file? arguments.first
|
env.remote.fs.file? arguments.first
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -33,7 +33,7 @@ module Producer::Core
|
|||||||
|
|
||||||
# FIXME: We rely a lot on mocking net-sftp heavily, while we already use a
|
# FIXME: We rely a lot on mocking net-sftp heavily, while we already use a
|
||||||
# part of net-ssh story helpers, which are more close to integration tests.
|
# part of net-ssh story helpers, which are more close to integration tests.
|
||||||
describe '#has_file?', :ssh do
|
describe '#file?', :ssh do
|
||||||
let(:file_path) { 'some_file_path' }
|
let(:file_path) { 'some_file_path' }
|
||||||
let(:stat) { double 'stat' }
|
let(:stat) { double 'stat' }
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ module Producer::Core
|
|||||||
before { allow(stat).to receive(:file?) { true } }
|
before { allow(stat).to receive(:file?) { true } }
|
||||||
|
|
||||||
it 'returns true' do
|
it 'returns true' do
|
||||||
expect(fs.has_file? file_path).to be true
|
expect(fs.file? file_path).to be true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ module Producer::Core
|
|||||||
before { allow(stat).to receive(:file?) { false } }
|
before { allow(stat).to receive(:file?) { false } }
|
||||||
|
|
||||||
it 'returns false' do
|
it 'returns false' do
|
||||||
expect(fs.has_file? file_path).to be false
|
expect(fs.file? file_path).to be false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -68,7 +68,7 @@ module Producer::Core
|
|||||||
end
|
end
|
||||||
|
|
||||||
it 'returns false' do
|
it 'returns false' do
|
||||||
expect(fs.has_file? file_path).to be false
|
expect(fs.file? file_path).to be false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -14,13 +14,13 @@ module Producer::Core
|
|||||||
before { sftp_story }
|
before { sftp_story }
|
||||||
|
|
||||||
it 'delegates the call on remote FS' do
|
it 'delegates the call on remote FS' do
|
||||||
expect(env.remote.fs).to receive(:has_file?).with(filepath)
|
expect(env.remote.fs).to receive(:file?).with(filepath)
|
||||||
has_file.verify
|
has_file.verify
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns the file existence' do
|
it 'returns the file existence' do
|
||||||
existence = double 'existence'
|
existence = double 'existence'
|
||||||
allow(env.remote.fs).to receive(:has_file?) { existence }
|
allow(env.remote.fs).to receive(:file?) { existence }
|
||||||
expect(has_file.verify).to be existence
|
expect(has_file.verify).to be existence
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user