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:
commit
a0a58d0569
2 changed files with 10 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue