From f0084e2852667fe33b18b29bab0b98f26a5244a9 Mon Sep 17 00:00:00 2001 From: Georg Gadinger Date: Sat, 7 Oct 2017 18:28:29 +0200 Subject: [PATCH] Add spec for Net::FTP#status(pathname) --- library/net/ftp/fixtures/server.rb | 8 ++++++-- library/net/ftp/status_spec.rb | 6 ++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/library/net/ftp/fixtures/server.rb b/library/net/ftp/fixtures/server.rb index a6741820ff..c6af6e270f 100644 --- a/library/net/ftp/fixtures/server.rb +++ b/library/net/ftp/fixtures/server.rb @@ -229,8 +229,12 @@ def size(filename) end end - def stat - self.response("211 System status, or system help reply. (STAT)") + def stat(param = :default) + if param == :default + self.response("211 System status, or system help reply. (STAT)") + else + self.response("211 System status, or system help reply. (STAT #{param})") + end end def stor(file) diff --git a/library/net/ftp/status_spec.rb b/library/net/ftp/status_spec.rb index 7e9927c3c8..243d3fc175 100644 --- a/library/net/ftp/status_spec.rb +++ b/library/net/ftp/status_spec.rb @@ -22,6 +22,12 @@ @ftp.last_response.should == "211 System status, or system help reply. (STAT)\n" end + ruby_version_is "2.4" do + it "sends the STAT command with an optional parameter to the server" do + @ftp.status("/pub").should == "211 System status, or system help reply. (STAT /pub)\n" + end + end + it "returns the received information" do @ftp.status.should == "211 System status, or system help reply. (STAT)\n" end