Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion test/net/ftp/test_buffered_socket.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

require "net/ftp"
require "test/unit"
require "ostruct"
require "stringio"

class BufferedSocketTest < Test::Unit::TestCase
Expand Down
12 changes: 5 additions & 7 deletions test/net/ftp/test_ftp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

require "net/ftp"
require "test/unit"
require "ostruct"
require "stringio"
require "tempfile"
require "tmpdir"
Expand Down Expand Up @@ -70,6 +69,9 @@ def test_connect_fail
end
end

FakeSocket = Struct.new(:remote_address)
FakeAddress = Struct.new(:ip_address)

def test_parse227
ftp = Net::FTP.new(nil, use_pasv_ip: true)
host, port = ftp.send(:parse227, "227 Entering Passive Mode (192,168,0,1,12,34)")
Expand All @@ -92,19 +94,15 @@ def test_parse227
end

ftp = Net::FTP.new
sock = OpenStruct.new
sock.remote_address = OpenStruct.new
sock.remote_address.ip_address = "10.0.0.1"
sock = FakeSocket.new(FakeAddress.new("10.0.0.1"))
ftp.instance_variable_set(:@bare_sock, sock)
host, port = ftp.send(:parse227, "227 Entering Passive Mode (192,168,0,1,12,34)")
assert_equal("10.0.0.1", host)
end

def test_parse229
ftp = Net::FTP.new
sock = OpenStruct.new
sock.remote_address = OpenStruct.new
sock.remote_address.ip_address = "1080:0000:0000:0000:0008:0800:200c:417a"
sock = FakeSocket.new(FakeAddress.new("1080:0000:0000:0000:0008:0800:200c:417a"))
ftp.instance_variable_set(:@bare_sock, sock)
host, port = ftp.send(:parse229, "229 Entering Passive Mode (|||3106|)")
assert_equal("1080:0000:0000:0000:0008:0800:200c:417a", host)
Expand Down
1 change: 0 additions & 1 deletion test/net/ftp/test_mlsx_entry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

require "net/ftp"
require "test/unit"
require "ostruct"
require "stringio"

class MLSxEntryTest < Test::Unit::TestCase
Expand Down