aboutsummaryrefslogtreecommitdiffstats
path: root/test/net/ftp
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-02-12 02:50:09 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-02-12 02:50:09 +0000
commit498db321937c2c52f4f0018b620b0a095ee9266f (patch)
tree22444c310c4c0a960d4764b5ca145a908cafd558 /test/net/ftp
parent6a8bb9bec3c410d50885f33a58d7aab2018efdb6 (diff)
downloadruby-498db321937c2c52f4f0018b620b0a095ee9266f.tar.gz
net/ftp.rb: NullSocket#closed?
* net/ftp.rb: add NullSocket#closed? to fix closing not opened connection. [Fix GH-1232] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/net/ftp')
-rw-r--r--test/net/ftp/test_ftp.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/net/ftp/test_ftp.rb b/test/net/ftp/test_ftp.rb
index 3af00e7da9..4759772cb1 100644
--- a/test/net/ftp/test_ftp.rb
+++ b/test/net/ftp/test_ftp.rb
@@ -29,6 +29,14 @@ class FTPTest < Test::Unit::TestCase
end
end
+ def test_closed_when_not_connected
+ ftp = Net::FTP.new
+ assert_equal(true, ftp.closed?)
+ assert_nothing_raised(Net::FTPConnectionError) do
+ ftp.close
+ end
+ end
+
def test_connect_fail
server = create_ftp_server { |sock|
sock.print("421 Service not available, closing control connection.\r\n")