summaryrefslogtreecommitdiff
path: root/spec/ruby/library/net-ftp/shared/last_response_code.rb
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2024-02-15 16:39:14 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2024-02-15 18:57:23 +0900
commit4a00fcbd92d6fbc5514e04c1de3a0540e84e996e (patch)
treeb18a90d3867aa383b8ee832de0bb1307698d3fd1 /spec/ruby/library/net-ftp/shared/last_response_code.rb
parentfa7529afd5566bab3d1db9bba6624122ffd1b4c8 (diff)
Rename and restructured net/ftp and net/http examples
Diffstat (limited to 'spec/ruby/library/net-ftp/shared/last_response_code.rb')
-rw-r--r--spec/ruby/library/net-ftp/shared/last_response_code.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/ruby/library/net-ftp/shared/last_response_code.rb b/spec/ruby/library/net-ftp/shared/last_response_code.rb
new file mode 100644
index 0000000000..4fe53677db
--- /dev/null
+++ b/spec/ruby/library/net-ftp/shared/last_response_code.rb
@@ -0,0 +1,25 @@
+describe :net_ftp_last_response_code, shared: true do
+ before :each do
+ @server = NetFTPSpecs::DummyFTP.new
+ @server.serve_once
+
+ @ftp = Net::FTP.new
+ @ftp.connect(@server.hostname, @server.server_port)
+ end
+
+ after :each do
+ @ftp.quit rescue nil
+ @ftp.close
+ @server.stop
+ end
+
+ it "returns the response code for the last response" do
+ @server.should_receive(:help).and_respond("200 Command okay.")
+ @ftp.help
+ @ftp.send(@method).should == "200"
+
+ @server.should_receive(:help).and_respond("212 Directory status.")
+ @ftp.help
+ @ftp.send(@method).should == "212"
+ end
+end