Permalink
Browse files

Re-added tests for spaces in filenames

  • Loading branch information...
1 parent 91e0fa6 commit d7cc39464f7006de77db24369bdddc2cba40a391 @delano delano committed Aug 16, 2010
Showing with 28 additions and 0 deletions.
  1. +14 −0 test/test_download.rb
  2. +14 −0 test/test_upload.rb
View
@@ -11,7 +11,21 @@ def test_download_file_should_transfer_file
assert_scripted { scp.download!("/path/to/remote.txt", "/path/to/local.txt") }
assert_equal "a" * 1234, file.io.string
end
+
+ def test_download_file_with_spaces_in_name_should_escape_remote_file_name
+ file = prepare_file("/path/to/local file.txt", "")
+ expect_scp_session "-f /path/to/remote\\ file.txt" do |channel|
+ channel.sends_ok
+ channel.gets_data "C0666 0 local file.txt\n"
+ channel.sends_ok
+ channel.gets_ok
+ channel.sends_ok
+ end
+
+ assert_scripted { scp.download!("/path/to/remote file.txt", "/path/to/local file.txt") }
+ end
+
def test_download_file_with_metacharacters_in_name_should_escape_remote_file_name
file = prepare_file("/path/to/local/#{awful_file_name}", "")
View
@@ -15,7 +15,21 @@ def test_upload_file_should_transfer_file
assert_scripted { scp.upload!("/path/to/local.txt", "/path/to/remote.txt") }
end
+
+ def test_upload_file_with_spaces_in_name_should_escape_remote_file_name
+ prepare_file("/path/to/local file.txt", "")
+ expect_scp_session "-t /path/to/remote\\ file.txt" do |channel|
+ channel.gets_ok
+ channel.sends_data "C0666 0 local file.txt\n"
+ channel.gets_ok
+ channel.sends_ok
+ channel.gets_ok
+ end
+
+ assert_scripted { scp.upload!("/path/to/local file.txt", "/path/to/remote file.txt") }
+ end
+
def test_upload_file_with_metacharacters_in_name_should_escape_remote_file_name
prepare_file("/path/to/local/#{awful_file_name}", "")

0 comments on commit d7cc394

Please sign in to comment.