From 103b9d1230078ff8bc55cc504004bfd9a43d2bf0 Mon Sep 17 00:00:00 2001 From: Thibault Jouan Date: Wed, 8 Jan 2014 22:30:52 +0000 Subject: [PATCH] Rename Remote::FS#{has_,}file? --- lib/producer/core/remote/fs.rb | 2 +- lib/producer/core/tests/has_file.rb | 2 +- spec/producer/core/remote/fs_spec.rb | 8 ++++---- spec/producer/core/tests/has_file_spec.rb | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/producer/core/remote/fs.rb b/lib/producer/core/remote/fs.rb index 19603f5..269643e 100644 --- a/lib/producer/core/remote/fs.rb +++ b/lib/producer/core/remote/fs.rb @@ -12,7 +12,7 @@ module Producer @sftp ||= @remote.session.sftp.connect end - def has_file?(path) + def file?(path) sftp.stat!(path).file? rescue Net::SFTP::StatusException false diff --git a/lib/producer/core/tests/has_file.rb b/lib/producer/core/tests/has_file.rb index 90f8459..12936c0 100644 --- a/lib/producer/core/tests/has_file.rb +++ b/lib/producer/core/tests/has_file.rb @@ -3,7 +3,7 @@ module Producer module Tests class HasFile < Test def verify - env.remote.fs.has_file? arguments.first + env.remote.fs.file? arguments.first end end end diff --git a/spec/producer/core/remote/fs_spec.rb b/spec/producer/core/remote/fs_spec.rb index 4709b96..a704fd1 100644 --- a/spec/producer/core/remote/fs_spec.rb +++ b/spec/producer/core/remote/fs_spec.rb @@ -33,7 +33,7 @@ module Producer::Core # 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. - describe '#has_file?', :ssh do + describe '#file?', :ssh do let(:file_path) { 'some_file_path' } let(:stat) { double 'stat' } @@ -47,7 +47,7 @@ module Producer::Core before { allow(stat).to receive(:file?) { true } } it 'returns true' do - expect(fs.has_file? file_path).to be true + expect(fs.file? file_path).to be true end end @@ -55,7 +55,7 @@ module Producer::Core before { allow(stat).to receive(:file?) { false } } it 'returns false' do - expect(fs.has_file? file_path).to be false + expect(fs.file? file_path).to be false end end end @@ -68,7 +68,7 @@ module Producer::Core end it 'returns false' do - expect(fs.has_file? file_path).to be false + expect(fs.file? file_path).to be false end end end diff --git a/spec/producer/core/tests/has_file_spec.rb b/spec/producer/core/tests/has_file_spec.rb index 7135776..9223d9e 100644 --- a/spec/producer/core/tests/has_file_spec.rb +++ b/spec/producer/core/tests/has_file_spec.rb @@ -14,13 +14,13 @@ module Producer::Core before { sftp_story } 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 end it 'returns the file existence' do 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 end end