Permalink
Browse files

Make sure we get an understandable error when attempting to upload a …

…non existing file.
  • Loading branch information...
1 parent 77663c5 commit a9a51c2c75aa780ac78980bbf9f51de3fea43ecc @dbackeus dbackeus committed Sep 26, 2011
Showing with 10 additions and 0 deletions.
  1. +2 −0 lib/capistrano/transfer.rb
  2. +8 −0 test/transfer_test.rb
@@ -203,6 +203,8 @@ def normalize(argument, session)
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
@@ -133,6 +133,14 @@ def test_errors_raised_for_a_scp_session_should_abort_session_and_continue_with_
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

0 comments on commit a9a51c2

Please sign in to comment.