--- test/test_download.rb 2018-01-22 01:47:38.932010818 +0100 +++ test/test_download.rb.1 2018-01-22 01:49:14.552011046 +0100 @@ -205,9 +205,11 @@ channel.sends_ok channel.gets_data "\1" end - - e = assert_raises(Net::SCP::Error) { scp.download!("/path/to/remote.txt", "/path/to/local.txt") } - assert_equal("\1", e.message) + + Net::SSH::Test::Extensions::IO.with_test_extension do + e = assert_raises(Net::SCP::Error) { scp.download!("/path/to/remote.txt", "/path/to/local.txt") } + assert_equal("\1", e.message) + end end def test_download_directory_should_raise_error_if_local_exists_and_is_not_directory @@ -223,8 +225,10 @@ channel.sends_ok end - e = assert_raises(Net::SCP::Error) { scp.download!("/path/to/remote", "/path/to/local", :recursive => true) } - assert_match(/exists and is not a directory/, e.message) + Net::SSH::Test::Extensions::IO.with_test_extension do + e = assert_raises(Net::SCP::Error) { scp.download!("/path/to/remote", "/path/to/local", :recursive => true) } + assert_match(/exists and is not a directory/, e.message) + end end def test_download_directory_should_create_directory_and_files_locally