Skip to content

Instantly share code, notes, and snippets.

@harrisj
Created January 28, 2010 01:34
Show Gist options
  • Save harrisj/288345 to your computer and use it in GitHub Desktop.
Save harrisj/288345 to your computer and use it in GitHub Desktop.
require_dependency 'net/ftp'
class FTPMock
def gettextfile(remote_path, local_path)
test_file = File.join(RAILS_ROOT, 'test', 'data', 'dbready', remote_path)
if !File.exists?(test_file)
raise Net::FTPPermError, test_file + ' not found!'
end
FileUtils.cp test_file, local_path
end
def connect(host, port = FTP_PORT)
end
def open_socket(host, port)
end
def close
end
end
module Net
class FTPError < StandardError; end
class FTPReplyError < FTPError; end
class FTPTempError < FTPError; end
class FTPPermError < FTPError; end
class FTPProtoError < FTPError; end
class FTP
def self.open(*params)
FTPMock.new
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment