1
0
Fork 0
mirror of https://github.com/capistrano/capistrano synced 2023-03-27 23:21:18 -04:00

Merge pull request #109 from dbackeus/master

Better errors when trying to upload non-existent files.

(This patch comes with brittle tests, if you have problems, please report them on the issue tracker.)
This commit is contained in:
Lee Hambley 2011-12-11 04:39:36 -08:00
commit a0a58d0569
2 changed files with 10 additions and 0 deletions

View file

@ -203,6 +203,8 @@ module Capistrano
end
def handle_error(error)
raise error if error.message.include?('expected a file to upload')
transfer = session_map[error.session]
transfer[:error] = error
transfer[:failed] = true

View file

@ -133,6 +133,14 @@ class TransferTest < Test::Unit::TestCase
transfer.process!
end
def test_uploading_a_non_existing_file_should_raise_an_understandable_error
s = session('app1')
error = Capistrano::Processable::SessionAssociation.on(ArgumentError.new('expected a file to upload'), s)
transfer = Capistrano::Transfer.new(:up, "from", "to", [], :via => :scp)
transfer.expects(:process_iteration).raises(error)
assert_raise(ArgumentError, 'expected a file to upload') { transfer.process! }
end
private
class ExceptionWithSession < ::Exception