features/support/test_client.rb in ftpd-0.4.0 vs features/support/test_client.rb in ftpd-0.5.0

- old
+ new

@@ -28,13 +28,14 @@ :mkdir, :nlst, :noop, :passive=, :pwd, + :quit, :rename, :rmdir, - :quit, + :status, :system def raw(*command) @ftp.sendcmd command.compact.join(' ') end @@ -86,9 +87,20 @@ def append_text(local_path, remote_path) command = ['APPE', remote_path].compact.join(' ') File.open(temp_path(local_path), 'rb') do |file| @ftp.storlines command, file + end + end + + def connected? + begin + @ftp.noop + true + rescue Net::FTPTempError => e + !!e.to_s =~ /^421/ + rescue EOFError + false end end private