summaryrefslogtreecommitdiff
path: root/test
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
commit0a19e7f0a3fa1be6d31a702f0bf39477c1b16f0a (patch)
tree22444c310c4c0a960d4764b5ca145a908cafd558 /test
parent41784333f12e8f38f6869f4dd35ab5a710d0cffe (diff)
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')
-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")