1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
This commit is contained in:
Benoit Daloze 2019-07-27 12:40:09 +02:00
parent a06301b103
commit 5c276e1cc9
1247 changed files with 5316 additions and 5028 deletions

View file

@ -18,7 +18,7 @@ describe "Net::FTP#abort" do
end
it "sends the ABOR command to the server" do
lambda { @ftp.abort }.should_not raise_error
-> { @ftp.abort }.should_not raise_error
end
it "ignores the response" do
@ -32,31 +32,31 @@ describe "Net::FTP#abort" do
it "does not raise any error when the response code is 225" do
@server.should_receive(:abor).and_respond("225 Data connection open; no transfer in progress.")
lambda { @ftp.abort }.should_not raise_error
-> { @ftp.abort }.should_not raise_error
end
it "does not raise any error when the response code is 226" do
@server.should_receive(:abor).and_respond("226 Closing data connection.")
lambda { @ftp.abort }.should_not raise_error
-> { @ftp.abort }.should_not raise_error
end
it "raises a Net::FTPProtoError when the response code is 500" do
@server.should_receive(:abor).and_respond("500 Syntax error, command unrecognized.")
lambda { @ftp.abort }.should raise_error(Net::FTPProtoError)
-> { @ftp.abort }.should raise_error(Net::FTPProtoError)
end
it "raises a Net::FTPProtoError when the response code is 501" do
@server.should_receive(:abor).and_respond("501 Syntax error in parameters or arguments.")
lambda { @ftp.abort }.should raise_error(Net::FTPProtoError)
-> { @ftp.abort }.should raise_error(Net::FTPProtoError)
end
it "raises a Net::FTPProtoError when the response code is 502" do
@server.should_receive(:abor).and_respond("502 Command not implemented.")
lambda { @ftp.abort }.should raise_error(Net::FTPProtoError)
-> { @ftp.abort }.should raise_error(Net::FTPProtoError)
end
it "raises a Net::FTPProtoError when the response code is 421" do
@server.should_receive(:abor).and_respond("421 Service not available, closing control connection.")
lambda { @ftp.abort }.should raise_error(Net::FTPProtoError)
-> { @ftp.abort }.should raise_error(Net::FTPProtoError)
end
end

View file

@ -28,31 +28,31 @@ describe "Net::FTP#acct" do
it "does not raise any error when the response code is 230" do
@server.should_receive(:acct).and_respond("230 User logged in, proceed.")
lambda { @ftp.acct("my_account") }.should_not raise_error
-> { @ftp.acct("my_account") }.should_not raise_error
end
it "raises a Net::FTPPermError when the response code is 530" do
@server.should_receive(:acct).and_respond("530 Not logged in.")
lambda { @ftp.acct("my_account") }.should raise_error(Net::FTPPermError)
-> { @ftp.acct("my_account") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:acct).and_respond("500 Syntax error, command unrecognized.")
lambda { @ftp.acct("my_account") }.should raise_error(Net::FTPPermError)
-> { @ftp.acct("my_account") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:acct).and_respond("501 Syntax error in parameters or arguments.")
lambda { @ftp.acct("my_account") }.should raise_error(Net::FTPPermError)
-> { @ftp.acct("my_account") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 503" do
@server.should_receive(:acct).and_respond("503 Bad sequence of commands.")
lambda { @ftp.acct("my_account") }.should raise_error(Net::FTPPermError)
-> { @ftp.acct("my_account") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:acct).and_respond("421 Service not available, closing control connection.")
lambda { @ftp.acct("my_account") }.should raise_error(Net::FTPTempError)
-> { @ftp.acct("my_account") }.should raise_error(Net::FTPTempError)
end
end

View file

@ -29,32 +29,32 @@ describe "Net::FTP#chdir" do
it "does not raise a Net::FTPPermError when the response code is 500" do
@server.should_receive(:cdup).and_respond("500 Syntax error, command unrecognized.")
lambda { @ftp.chdir("..") }.should_not raise_error(Net::FTPPermError)
-> { @ftp.chdir("..") }.should_not raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:cdup).and_respond("501 Syntax error in parameters or arguments.")
lambda { @ftp.chdir("..") }.should raise_error(Net::FTPPermError)
-> { @ftp.chdir("..") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 502" do
@server.should_receive(:cdup).and_respond("502 Command not implemented.")
lambda { @ftp.chdir("..") }.should raise_error(Net::FTPPermError)
-> { @ftp.chdir("..") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:cdup).and_respond("421 Service not available, closing control connection.")
lambda { @ftp.chdir("..") }.should raise_error(Net::FTPTempError)
-> { @ftp.chdir("..") }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 530" do
@server.should_receive(:cdup).and_respond("530 Not logged in.")
lambda { @ftp.chdir("..") }.should raise_error(Net::FTPPermError)
-> { @ftp.chdir("..") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 550" do
@server.should_receive(:cdup).and_respond("550 Requested action not taken.")
lambda { @ftp.chdir("..") }.should raise_error(Net::FTPPermError)
-> { @ftp.chdir("..") }.should raise_error(Net::FTPPermError)
end
end
@ -69,31 +69,31 @@ describe "Net::FTP#chdir" do
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:cwd).and_respond("500 Syntax error, command unrecognized.")
lambda { @ftp.chdir("test") }.should raise_error(Net::FTPPermError)
-> { @ftp.chdir("test") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:cwd).and_respond("501 Syntax error in parameters or arguments.")
lambda { @ftp.chdir("test") }.should raise_error(Net::FTPPermError)
-> { @ftp.chdir("test") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 502" do
@server.should_receive(:cwd).and_respond("502 Command not implemented.")
lambda { @ftp.chdir("test") }.should raise_error(Net::FTPPermError)
-> { @ftp.chdir("test") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:cwd).and_respond("421 Service not available, closing control connection.")
lambda { @ftp.chdir("test") }.should raise_error(Net::FTPTempError)
-> { @ftp.chdir("test") }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 530" do
@server.should_receive(:cwd).and_respond("530 Not logged in.")
lambda { @ftp.chdir("test") }.should raise_error(Net::FTPPermError)
-> { @ftp.chdir("test") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 550" do
@server.should_receive(:cwd).and_respond("550 Requested action not taken.")
lambda { @ftp.chdir("test") }.should raise_error(Net::FTPPermError)
-> { @ftp.chdir("test") }.should raise_error(Net::FTPPermError)
end
end

View file

@ -19,7 +19,7 @@ describe "Net::FTP#connect" do
end
it "tries to connect to the FTP Server on the given host and port" do
lambda { @ftp.connect(@server.hostname, @server.server_port) }.should_not raise_error
-> { @ftp.connect(@server.hostname, @server.server_port) }.should_not raise_error
end
it "returns nil" do
@ -28,22 +28,22 @@ describe "Net::FTP#connect" do
it "prints a small debug line when in debug mode" do
@ftp.debug_mode = true
lambda { @ftp.connect(@server.hostname, @server.server_port) }.should output(/#{"connect: "}#{@server.hostname}#{", "}#{@server.server_port}#{"\\nget: 220 Dummy FTP Server ready!"}/)
-> { @ftp.connect(@server.hostname, @server.server_port) }.should output(/#{"connect: "}#{@server.hostname}#{", "}#{@server.server_port}#{"\\nget: 220 Dummy FTP Server ready!"}/)
@ftp.debug_mode = false
end
it "does not raise any error when the response code is 220" do
@server.connect_message = "220 Dummy FTP Server ready!"
lambda { @ftp.connect(@server.hostname, @server.server_port) }.should_not raise_error
-> { @ftp.connect(@server.hostname, @server.server_port) }.should_not raise_error
end
it "raises a Net::FTPReplyError when the response code is 120" do
@server.connect_message = "120 Service ready in nnn minutes."
lambda { @ftp.connect(@server.hostname, @server.server_port) }.should raise_error(Net::FTPReplyError)
-> { @ftp.connect(@server.hostname, @server.server_port) }.should raise_error(Net::FTPReplyError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.connect_message = "421 Service not available, closing control connection."
lambda { @ftp.connect(@server.hostname, @server.server_port) }.should raise_error(Net::FTPTempError)
-> { @ftp.connect(@server.hostname, @server.server_port) }.should raise_error(Net::FTPTempError)
end
end

View file

@ -24,36 +24,36 @@ describe "Net::FTP#delete" do
it "raises a Net::FTPTempError when the response code is 450" do
@server.should_receive(:dele).and_respond("450 Requested file action not taken.")
lambda { @ftp.delete("test.file") }.should raise_error(Net::FTPTempError)
-> { @ftp.delete("test.file") }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 550" do
@server.should_receive(:dele).and_respond("550 Requested action not taken.")
lambda { @ftp.delete("test.file") }.should raise_error(Net::FTPPermError)
-> { @ftp.delete("test.file") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:dele).and_respond("500 Syntax error, command unrecognized.")
lambda { @ftp.delete("test.file") }.should raise_error(Net::FTPPermError)
-> { @ftp.delete("test.file") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:dele).and_respond("501 Syntax error in parameters or arguments.")
lambda { @ftp.delete("test.file") }.should raise_error(Net::FTPPermError)
-> { @ftp.delete("test.file") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 502" do
@server.should_receive(:dele).and_respond("502 Command not implemented.")
lambda { @ftp.delete("test.file") }.should raise_error(Net::FTPPermError)
-> { @ftp.delete("test.file") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:dele).and_respond("421 Service not available, closing control connection.")
lambda { @ftp.delete("test.file") }.should raise_error(Net::FTPTempError)
-> { @ftp.delete("test.file") }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 530" do
@server.should_receive(:dele).and_respond("530 Not logged in.")
lambda { @ftp.delete("test.file") }.should raise_error(Net::FTPPermError)
-> { @ftp.delete("test.file") }.should raise_error(Net::FTPPermError)
end
end

View file

@ -86,7 +86,7 @@ module NetFTPSpecs
end
def and_respond(text)
@handlers[@handler_for] = lambda { |s, *args| s.response(text) }
@handlers[@handler_for] = -> s, *args { s.response(text) }
end
##

View file

@ -36,31 +36,31 @@ describe "Net::FTP#help" do
it "does not raise any error when the response code is 211" do
@server.should_receive(:help).and_respond("211 System status, or system help reply.")
lambda { @ftp.help }.should_not raise_error
-> { @ftp.help }.should_not raise_error
end
it "does not raise any error when the response code is 214" do
@server.should_receive(:help).and_respond("214 Help message.")
lambda { @ftp.help }.should_not raise_error
-> { @ftp.help }.should_not raise_error
end
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:help).and_respond("500 Syntax error, command unrecognized.")
lambda { @ftp.help }.should raise_error(Net::FTPPermError)
-> { @ftp.help }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:help).and_respond("501 Syntax error in parameters or arguments.")
lambda { @ftp.help }.should raise_error(Net::FTPPermError)
-> { @ftp.help }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 502" do
@server.should_receive(:help).and_respond("502 Command not implemented.")
lambda { @ftp.help }.should raise_error(Net::FTPPermError)
-> { @ftp.help }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:help).and_respond("421 Service not available, closing control connection.")
lambda { @ftp.help }.should raise_error(Net::FTPTempError)
-> { @ftp.help }.should raise_error(Net::FTPTempError)
end
end

View file

@ -32,7 +32,7 @@ describe "Net::FTP#login" do
it "raises a Net::FTPReplyError when the server requests an account" do
@server.should_receive(:user).and_respond("331 User name okay, need password.")
@server.should_receive(:pass).and_respond("332 Need account for login.")
lambda { @ftp.login }.should raise_error(Net::FTPReplyError)
-> { @ftp.login }.should raise_error(Net::FTPReplyError)
end
end
@ -44,13 +44,13 @@ describe "Net::FTP#login" do
it "raises a Net::FTPReplyError when the server requests a password, but none was given" do
@server.should_receive(:user).and_respond("331 User name okay, need password.")
lambda { @ftp.login("rubyspec") }.should raise_error(Net::FTPReplyError)
-> { @ftp.login("rubyspec") }.should raise_error(Net::FTPReplyError)
end
it "raises a Net::FTPReplyError when the server requests an account, but none was given" do
@server.should_receive(:user).and_respond("331 User name okay, need password.")
@server.should_receive(:pass).and_respond("332 Need account for login.")
lambda { @ftp.login("rubyspec") }.should raise_error(Net::FTPReplyError)
-> { @ftp.login("rubyspec") }.should raise_error(Net::FTPReplyError)
end
end
@ -69,7 +69,7 @@ describe "Net::FTP#login" do
it "raises a Net::FTPReplyError when the server requests an account" do
@server.should_receive(:user).and_respond("331 User name okay, need password.")
@server.should_receive(:pass).and_respond("332 Need account for login.")
lambda { @ftp.login("rubyspec", "rocks") }.should raise_error(Net::FTPReplyError)
-> { @ftp.login("rubyspec", "rocks") }.should raise_error(Net::FTPReplyError)
end
end
@ -96,27 +96,27 @@ describe "Net::FTP#login" do
describe "when the USER command fails" do
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:user).and_respond("500 Syntax error, command unrecognized.")
lambda { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError)
-> { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:user).and_respond("501 Syntax error in parameters or arguments.")
lambda { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError)
-> { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 502" do
@server.should_receive(:user).and_respond("502 Command not implemented.")
lambda { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError)
-> { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:user).and_respond("421 Service not available, closing control connection.")
lambda { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPTempError)
-> { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 530" do
@server.should_receive(:user).and_respond("530 Not logged in.")
lambda { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError)
-> { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError)
end
end
@ -127,32 +127,32 @@ describe "Net::FTP#login" do
it "does not raise an Error when the response code is 202" do
@server.should_receive(:pass).and_respond("202 Command not implemented, superfluous at this site.")
lambda { @ftp.login("rubyspec", "rocks", "account") }.should_not raise_error
-> { @ftp.login("rubyspec", "rocks", "account") }.should_not raise_error
end
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:pass).and_respond("500 Syntax error, command unrecognized.")
lambda { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError)
-> { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:pass).and_respond("501 Syntax error in parameters or arguments.")
lambda { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError)
-> { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 502" do
@server.should_receive(:pass).and_respond("502 Command not implemented.")
lambda { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError)
-> { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:pass).and_respond("421 Service not available, closing control connection.")
lambda { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPTempError)
-> { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 530" do
@server.should_receive(:pass).and_respond("530 Not logged in.")
lambda { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError)
-> { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError)
end
end
@ -164,32 +164,32 @@ describe "Net::FTP#login" do
it "does not raise an Error when the response code is 202" do
@server.should_receive(:acct).and_respond("202 Command not implemented, superfluous at this site.")
lambda { @ftp.login("rubyspec", "rocks", "account") }.should_not raise_error
-> { @ftp.login("rubyspec", "rocks", "account") }.should_not raise_error
end
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:acct).and_respond("500 Syntax error, command unrecognized.")
lambda { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError)
-> { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:acct).and_respond("501 Syntax error in parameters or arguments.")
lambda { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError)
-> { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 502" do
@server.should_receive(:acct).and_respond("502 Command not implemented.")
lambda { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError)
-> { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:acct).and_respond("421 Service not available, closing control connection.")
lambda { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPTempError)
-> { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 530" do
@server.should_receive(:acct).and_respond("530 Not logged in.")
lambda { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError)
-> { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError)
end
end
end

View file

@ -28,11 +28,11 @@ describe "Net::FTP#mdtm" do
it "raises a Net::FTPPermError when the response code is 550" do
@server.should_receive(:mdtm).and_respond("550 Requested action not taken.")
lambda { @ftp.mdtm("test.file") }.should raise_error(Net::FTPPermError)
-> { @ftp.mdtm("test.file") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:mdtm).and_respond("421 Service not available, closing control connection.")
lambda { @ftp.mdtm("test.file") }.should raise_error(Net::FTPTempError)
-> { @ftp.mdtm("test.file") }.should raise_error(Net::FTPTempError)
end
end

View file

@ -31,31 +31,31 @@ describe "Net::FTP#mkdir" do
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:mkd).and_respond("500 Syntax error, command unrecognized.")
lambda { @ftp.mkdir("test.folder") }.should raise_error(Net::FTPPermError)
-> { @ftp.mkdir("test.folder") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:mkd).and_respond("501 Syntax error in parameters or arguments.")
lambda { @ftp.mkdir("test.folder") }.should raise_error(Net::FTPPermError)
-> { @ftp.mkdir("test.folder") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 502" do
@server.should_receive(:mkd).and_respond("502 Command not implemented.")
lambda { @ftp.mkdir("test.folder") }.should raise_error(Net::FTPPermError)
-> { @ftp.mkdir("test.folder") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:mkd).and_respond("421 Service not available, closing control connection.")
lambda { @ftp.mkdir("test.folder") }.should raise_error(Net::FTPTempError)
-> { @ftp.mkdir("test.folder") }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 530" do
@server.should_receive(:mkd).and_respond("530 Not logged in.")
lambda { @ftp.mkdir("test.folder") }.should raise_error(Net::FTPPermError)
-> { @ftp.mkdir("test.folder") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 550" do
@server.should_receive(:mkd).and_respond("550 Requested action not taken.")
lambda { @ftp.mkdir("test.folder") }.should raise_error(Net::FTPPermError)
-> { @ftp.mkdir("test.folder") }.should raise_error(Net::FTPPermError)
end
end

View file

@ -40,11 +40,11 @@ describe "Net::FTP#mtime" do
it "raises a Net::FTPPermError when the response code is 550" do
@server.should_receive(:mdtm).and_respond("550 Requested action not taken.")
lambda { @ftp.mtime("test.file") }.should raise_error(Net::FTPPermError)
-> { @ftp.mtime("test.file") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:mdtm).and_respond("421 Service not available, closing control connection.")
lambda { @ftp.mtime("test.file") }.should raise_error(Net::FTPTempError)
-> { @ftp.mtime("test.file") }.should raise_error(Net::FTPTempError)
end
end

View file

@ -35,32 +35,32 @@ describe "Net::FTP#nlst" do
describe "when the NLST command fails" do
it "raises a Net::FTPTempError when the response code is 450" do
@server.should_receive(:nlst).and_respond("450 Requested file action not taken..")
lambda { @ftp.nlst }.should raise_error(Net::FTPTempError)
-> { @ftp.nlst }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:nlst).and_respond("500 Syntax error, command unrecognized.")
lambda { @ftp.nlst }.should raise_error(Net::FTPPermError)
-> { @ftp.nlst }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:nlst).and_respond("501 Syntax error, command unrecognized.")
lambda { @ftp.nlst }.should raise_error(Net::FTPPermError)
-> { @ftp.nlst }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 502" do
@server.should_receive(:nlst).and_respond("502 Command not implemented.")
lambda { @ftp.nlst }.should raise_error(Net::FTPPermError)
-> { @ftp.nlst }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:nlst).and_respond("421 Service not available, closing control connection.")
lambda { @ftp.nlst }.should raise_error(Net::FTPTempError)
-> { @ftp.nlst }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 530" do
@server.should_receive(:nlst).and_respond("530 Not logged in.")
lambda { @ftp.nlst }.should raise_error(Net::FTPPermError)
-> { @ftp.nlst }.should raise_error(Net::FTPPermError)
end
end
@ -68,25 +68,25 @@ describe "Net::FTP#nlst" do
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:eprt).and_respond("500 Syntax error, command unrecognized.")
@server.should_receive(:port).and_respond("500 Syntax error, command unrecognized.")
lambda { @ftp.nlst }.should raise_error(Net::FTPPermError)
-> { @ftp.nlst }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:eprt).and_respond("501 Syntax error in parameters or arguments.")
@server.should_receive(:port).and_respond("501 Syntax error in parameters or arguments.")
lambda { @ftp.nlst }.should raise_error(Net::FTPPermError)
-> { @ftp.nlst }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:eprt).and_respond("421 Service not available, closing control connection.")
@server.should_receive(:port).and_respond("421 Service not available, closing control connection.")
lambda { @ftp.nlst }.should raise_error(Net::FTPTempError)
-> { @ftp.nlst }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 530" do
@server.should_receive(:eprt).and_respond("530 Not logged in.")
@server.should_receive(:port).and_respond("530 Not logged in.")
lambda { @ftp.nlst }.should raise_error(Net::FTPPermError)
-> { @ftp.nlst }.should raise_error(Net::FTPPermError)
end
end
end

View file

@ -28,11 +28,11 @@ describe "Net::FTP#noop" do
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:noop).and_respond("500 Syntax error, command unrecognized.")
lambda { @ftp.noop }.should raise_error(Net::FTPPermError)
-> { @ftp.noop }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:noop).and_respond("421 Service not available, closing control connection.")
lambda { @ftp.noop }.should raise_error(Net::FTPTempError)
-> { @ftp.noop }.should raise_error(Net::FTPTempError)
end
end

View file

@ -28,26 +28,26 @@ describe "Net::FTP#pwd" do
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:pwd).and_respond("500 Syntax error, command unrecognized.")
lambda { @ftp.pwd }.should raise_error(Net::FTPPermError)
-> { @ftp.pwd }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:pwd).and_respond("501 Syntax error in parameters or arguments.")
lambda { @ftp.pwd }.should raise_error(Net::FTPPermError)
-> { @ftp.pwd }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 502" do
@server.should_receive(:pwd).and_respond("502 Command not implemented.")
lambda { @ftp.pwd }.should raise_error(Net::FTPPermError)
-> { @ftp.pwd }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:pwd).and_respond("421 Service not available, closing control connection.")
lambda { @ftp.pwd }.should raise_error(Net::FTPTempError)
-> { @ftp.pwd }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 550" do
@server.should_receive(:pwd).and_respond("550 Requested action not taken.")
lambda { @ftp.pwd }.should raise_error(Net::FTPPermError)
-> { @ftp.pwd }.should raise_error(Net::FTPPermError)
end
end

View file

@ -31,64 +31,64 @@ describe "Net::FTP#rename" do
describe "when the RNFR command fails" do
it "raises a Net::FTPTempError when the response code is 450" do
@server.should_receive(:rnfr).and_respond("450 Requested file action not taken.")
lambda { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPTempError)
-> { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 550" do
@server.should_receive(:rnfr).and_respond("550 Requested action not taken.")
lambda { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPPermError)
-> { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:rnfr).and_respond("501 Syntax error in parameters or arguments.")
lambda { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPPermError)
-> { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 502" do
@server.should_receive(:rnfr).and_respond("502 Command not implemented.")
lambda { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPPermError)
-> { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:rnfr).and_respond("421 Service not available, closing control connection.")
lambda { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPTempError)
-> { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 530" do
@server.should_receive(:rnfr).and_respond("530 Not logged in.")
lambda { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPPermError)
-> { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPPermError)
end
end
describe "when the RNTO command fails" do
it "raises a Net::FTPPermError when the response code is 532" do
@server.should_receive(:rnfr).and_respond("532 Need account for storing files.")
lambda { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPPermError)
-> { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 553" do
@server.should_receive(:rnto).and_respond("553 Requested action not taken.")
lambda { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPPermError)
-> { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:rnto).and_respond("501 Syntax error in parameters or arguments.")
lambda { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPPermError)
-> { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 502" do
@server.should_receive(:rnto).and_respond("502 Command not implemented.")
lambda { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPPermError)
-> { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:rnto).and_respond("421 Service not available, closing control connection.")
lambda { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPTempError)
-> { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 530" do
@server.should_receive(:rnto).and_respond("530 Not logged in.")
lambda { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPPermError)
-> { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPPermError)
end
end
end

View file

@ -7,7 +7,7 @@ describe "Net::FTP#return_code" do
end
it "outputs a warning and returns a newline" do
lambda do
-> do
@ftp.return_code.should == "\n"
end.should complain(/warning: Net::FTP#return_code is obsolete and do nothing/)
end
@ -19,6 +19,6 @@ describe "Net::FTP#return_code=" do
end
it "outputs a warning" do
lambda { @ftp.return_code = 123 }.should complain(/warning: Net::FTP#return_code= is obsolete and do nothing/)
-> { @ftp.return_code = 123 }.should complain(/warning: Net::FTP#return_code= is obsolete and do nothing/)
end
end

View file

@ -28,31 +28,31 @@ describe "Net::FTP#rmdir" do
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:rmd).and_respond("500 Syntax error, command unrecognized.")
lambda { @ftp.rmdir("test.folder") }.should raise_error(Net::FTPPermError)
-> { @ftp.rmdir("test.folder") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:rmd).and_respond("501 Syntax error in parameters or arguments.")
lambda { @ftp.rmdir("test.folder") }.should raise_error(Net::FTPPermError)
-> { @ftp.rmdir("test.folder") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 502" do
@server.should_receive(:rmd).and_respond("502 Command not implemented.")
lambda { @ftp.rmdir("test.folder") }.should raise_error(Net::FTPPermError)
-> { @ftp.rmdir("test.folder") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:rmd).and_respond("421 Service not available, closing control connection.")
lambda { @ftp.rmdir("test.folder") }.should raise_error(Net::FTPTempError)
-> { @ftp.rmdir("test.folder") }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 530" do
@server.should_receive(:rmd).and_respond("530 Not logged in.")
lambda { @ftp.rmdir("test.folder") }.should raise_error(Net::FTPPermError)
-> { @ftp.rmdir("test.folder") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 550" do
@server.should_receive(:rmd).and_respond("550 Requested action not taken.")
lambda { @ftp.rmdir("test.folder") }.should raise_error(Net::FTPPermError)
-> { @ftp.rmdir("test.folder") }.should raise_error(Net::FTPPermError)
end
end

View file

@ -28,27 +28,27 @@ describe "Net::FTP#sendcmd" do
it "raises no error when the response code is 1xx, 2xx or 3xx" do
@server.should_receive(:help).and_respond("120 Service ready in nnn minutes.")
lambda { @ftp.sendcmd("HELP") }.should_not raise_error
-> { @ftp.sendcmd("HELP") }.should_not raise_error
@server.should_receive(:help).and_respond("200 Command okay.")
lambda { @ftp.sendcmd("HELP") }.should_not raise_error
-> { @ftp.sendcmd("HELP") }.should_not raise_error
@server.should_receive(:help).and_respond("350 Requested file action pending further information.")
lambda { @ftp.sendcmd("HELP") }.should_not raise_error
-> { @ftp.sendcmd("HELP") }.should_not raise_error
end
it "raises a Net::FTPTempError when the response code is 4xx" do
@server.should_receive(:help).and_respond("421 Service not available, closing control connection.")
lambda { @ftp.sendcmd("HELP") }.should raise_error(Net::FTPTempError)
-> { @ftp.sendcmd("HELP") }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 5xx" do
@server.should_receive(:help).and_respond("500 Syntax error, command unrecognized.")
lambda { @ftp.sendcmd("HELP") }.should raise_error(Net::FTPPermError)
-> { @ftp.sendcmd("HELP") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPProtoError when the response code is not between 1xx-5xx" do
@server.should_receive(:help).and_respond("999 Invalid response.")
lambda { @ftp.sendcmd("HELP") }.should raise_error(Net::FTPProtoError)
-> { @ftp.sendcmd("HELP") }.should raise_error(Net::FTPProtoError)
end
end

View file

@ -60,32 +60,32 @@ describe :net_ftp_getbinaryfile, shared: :true do
describe "and the REST command fails" do
it "raises a Net::FTPProtoError when the response code is 550" do
@server.should_receive(:rest).and_respond("Requested action not taken.")
lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPProtoError)
-> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPProtoError)
end
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:rest).and_respond("500 Syntax error, command unrecognized.")
lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
-> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:rest).and_respond("501 Syntax error, command unrecognized.")
lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
-> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 502" do
@server.should_receive(:rest).and_respond("502 Command not implemented.")
lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
-> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:rest).and_respond("421 Service not available, closing control connection.")
lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPTempError)
-> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 530" do
@server.should_receive(:rest).and_respond("530 Not logged in.")
lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
-> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
end
end
end
@ -93,32 +93,32 @@ describe :net_ftp_getbinaryfile, shared: :true do
describe "when the RETR command fails" do
it "raises a Net::FTPTempError when the response code is 450" do
@server.should_receive(:retr).and_respond("450 Requested file action not taken.")
lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPTempError)
-> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPProtoError when the response code is 550" do
@server.should_receive(:retr).and_respond("Requested action not taken.")
lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPProtoError)
-> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPProtoError)
end
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:retr).and_respond("500 Syntax error, command unrecognized.")
lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
-> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:retr).and_respond("501 Syntax error, command unrecognized.")
lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
-> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:retr).and_respond("421 Service not available, closing control connection.")
lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPTempError)
-> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 530" do
@server.should_receive(:retr).and_respond("530 Not logged in.")
lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
-> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
end
end
@ -126,25 +126,25 @@ describe :net_ftp_getbinaryfile, shared: :true do
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:eprt).and_respond("500 Syntax error, command unrecognized.")
@server.should_receive(:port).and_respond("500 Syntax error, command unrecognized.")
lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
-> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:eprt).and_respond("501 Syntax error in parameters or arguments.")
@server.should_receive(:port).and_respond("501 Syntax error in parameters or arguments.")
lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
-> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:eprt).and_respond("421 Service not available, closing control connection.")
@server.should_receive(:port).and_respond("421 Service not available, closing control connection.")
lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPTempError)
-> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 530" do
@server.should_receive(:eprt).and_respond("530 Not logged in.")
@server.should_receive(:port).and_respond("530 Not logged in.")
lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
-> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
end
end
end

View file

@ -43,32 +43,32 @@ describe :net_ftp_gettextfile, shared: :true do
describe "when the RETR command fails" do
it "raises a Net::FTPTempError when the response code is 450" do
@server.should_receive(:retr).and_respond("450 Requested file action not taken.")
lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPTempError)
-> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPProtoError when the response code is 550" do
@server.should_receive(:retr).and_respond("Requested action not taken.")
lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPProtoError)
-> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPProtoError)
end
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:retr).and_respond("500 Syntax error, command unrecognized.")
lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
-> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:retr).and_respond("501 Syntax error, command unrecognized.")
lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
-> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:retr).and_respond("421 Service not available, closing control connection.")
lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPTempError)
-> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 530" do
@server.should_receive(:retr).and_respond("530 Not logged in.")
lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
-> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
end
end
@ -76,25 +76,25 @@ describe :net_ftp_gettextfile, shared: :true do
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:eprt).and_respond("500 Syntax error, command unrecognized.")
@server.should_receive(:port).and_respond("500 Syntax error, command unrecognized.")
lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
-> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:eprt).and_respond("501 Syntax error in parameters or arguments.")
@server.should_receive(:port).and_respond("501 Syntax error in parameters or arguments.")
lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
-> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:eprt).and_respond("421 Service not available, closing control connection.")
@server.should_receive(:port).and_respond("421 Service not available, closing control connection.")
lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPTempError)
-> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 530" do
@server.should_receive(:eprt).and_respond("530 Not logged in.")
@server.should_receive(:port).and_respond("530 Not logged in.")
lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
-> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError)
end
end
end

View file

@ -47,32 +47,32 @@ describe :net_ftp_list, shared: true do
describe "when the LIST command fails" do
it "raises a Net::FTPTempError when the response code is 450" do
@server.should_receive(:list).and_respond("450 Requested file action not taken..")
lambda { @ftp.send(@method) }.should raise_error(Net::FTPTempError)
-> { @ftp.send(@method) }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:list).and_respond("500 Syntax error, command unrecognized.")
lambda { @ftp.send(@method) }.should raise_error(Net::FTPPermError)
-> { @ftp.send(@method) }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:list).and_respond("501 Syntax error, command unrecognized.")
lambda { @ftp.send(@method) }.should raise_error(Net::FTPPermError)
-> { @ftp.send(@method) }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 502" do
@server.should_receive(:list).and_respond("502 Command not implemented.")
lambda { @ftp.send(@method) }.should raise_error(Net::FTPPermError)
-> { @ftp.send(@method) }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:list).and_respond("421 Service not available, closing control connection.")
lambda { @ftp.send(@method) }.should raise_error(Net::FTPTempError)
-> { @ftp.send(@method) }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 530" do
@server.should_receive(:list).and_respond("530 Not logged in.")
lambda { @ftp.send(@method) }.should raise_error(Net::FTPPermError)
-> { @ftp.send(@method) }.should raise_error(Net::FTPPermError)
end
end
@ -80,25 +80,25 @@ describe :net_ftp_list, shared: true do
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:eprt).and_respond("500 Syntax error, command unrecognized.")
@server.should_receive(:port).and_respond("500 Syntax error, command unrecognized.")
lambda { @ftp.send(@method) }.should raise_error(Net::FTPPermError)
-> { @ftp.send(@method) }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:eprt).and_respond("501 Syntax error in parameters or arguments.")
@server.should_receive(:port).and_respond("501 Syntax error in parameters or arguments.")
lambda { @ftp.send(@method) }.should raise_error(Net::FTPPermError)
-> { @ftp.send(@method) }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:eprt).and_respond("421 Service not available, closing control connection.")
@server.should_receive(:port).and_respond("421 Service not available, closing control connection.")
lambda { @ftp.send(@method) }.should raise_error(Net::FTPTempError)
-> { @ftp.send(@method) }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 530" do
@server.should_receive(:eprt).and_respond("530 Not logged in.")
@server.should_receive(:port).and_respond("530 Not logged in.")
lambda { @ftp.send(@method) }.should raise_error(Net::FTPPermError)
-> { @ftp.send(@method) }.should raise_error(Net::FTPPermError)
end
end
end

View file

@ -67,32 +67,32 @@ describe :net_ftp_putbinaryfile, shared: :true do
describe "and the APPE command fails" do
it "raises a Net::FTPProtoError when the response code is 550" do
@server.should_receive(:appe).and_respond("Requested action not taken.")
lambda { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPProtoError)
-> { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPProtoError)
end
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:appe).and_respond("500 Syntax error, command unrecognized.")
lambda { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError)
-> { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:appe).and_respond("501 Syntax error, command unrecognized.")
lambda { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError)
-> { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 502" do
@server.should_receive(:appe).and_respond("502 Command not implemented.")
lambda { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError)
-> { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:appe).and_respond("421 Service not available, closing control connection.")
lambda { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPTempError)
-> { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 530" do
@server.should_receive(:appe).and_respond("530 Not logged in.")
lambda { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError)
-> { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError)
end
end
end
@ -100,42 +100,42 @@ describe :net_ftp_putbinaryfile, shared: :true do
describe "when the STOR command fails" do
it "raises a Net::FTPPermError when the response code is 532" do
@server.should_receive(:stor).and_respond("532 Need account for storing files.")
lambda { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError)
-> { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 450" do
@server.should_receive(:stor).and_respond("450 Requested file action not taken.")
lambda { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPTempError)
-> { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPTempError when the response code is 452" do
@server.should_receive(:stor).and_respond("452 Requested action not taken.")
lambda { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPTempError)
-> { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 553" do
@server.should_receive(:stor).and_respond("553 Requested action not taken.")
lambda { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError)
-> { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:stor).and_respond("500 Syntax error, command unrecognized.")
lambda { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError)
-> { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:stor).and_respond("501 Syntax error in parameters or arguments.")
lambda { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError)
-> { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:stor).and_respond("421 Service not available, closing control connection.")
lambda { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPTempError)
-> { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 530" do
@server.should_receive(:stor).and_respond("530 Not logged in.")
lambda { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError)
-> { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError)
end
end
@ -143,25 +143,25 @@ describe :net_ftp_putbinaryfile, shared: :true do
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:eprt).and_respond("500 Syntax error, command unrecognized.")
@server.should_receive(:port).and_respond("500 Syntax error, command unrecognized.")
lambda { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError)
-> { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:eprt).and_respond("501 Syntax error in parameters or arguments.")
@server.should_receive(:port).and_respond("501 Syntax error in parameters or arguments.")
lambda { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError)
-> { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:eprt).and_respond("421 Service not available, closing control connection.")
@server.should_receive(:port).and_respond("421 Service not available, closing control connection.")
lambda { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPTempError)
-> { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 530" do
@server.should_receive(:eprt).and_respond("530 Not logged in.")
@server.should_receive(:port).and_respond("530 Not logged in.")
lambda { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError)
-> { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError)
end
end
end

View file

@ -53,42 +53,42 @@ describe :net_ftp_puttextfile, shared: true do
describe "when the STOR command fails" do
it "raises a Net::FTPPermError when the response code is 532" do
@server.should_receive(:stor).and_respond("532 Need account for storing files.")
lambda { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPPermError)
-> { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 450" do
@server.should_receive(:stor).and_respond("450 Requested file action not taken.")
lambda { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPTempError)
-> { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPTempError when the response code is 452" do
@server.should_receive(:stor).and_respond("452 Requested action not taken.")
lambda { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPTempError)
-> { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 553" do
@server.should_receive(:stor).and_respond("553 Requested action not taken.")
lambda { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPPermError)
-> { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:stor).and_respond("500 Syntax error, command unrecognized.")
lambda { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPPermError)
-> { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:stor).and_respond("501 Syntax error in parameters or arguments.")
lambda { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPPermError)
-> { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:stor).and_respond("421 Service not available, closing control connection.")
lambda { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPTempError)
-> { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 530" do
@server.should_receive(:stor).and_respond("530 Not logged in.")
lambda { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPPermError)
-> { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPPermError)
end
end
@ -96,25 +96,25 @@ describe :net_ftp_puttextfile, shared: true do
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:eprt).and_respond("500 Syntax error, command unrecognized.")
@server.should_receive(:port).and_respond("500 Syntax error, command unrecognized.")
lambda { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPPermError)
-> { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:eprt).and_respond("501 Syntax error in parameters or arguments.")
@server.should_receive(:port).and_respond("501 Syntax error in parameters or arguments.")
lambda { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPPermError)
-> { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:eprt).and_respond("421 Service not available, closing control connection.")
@server.should_receive(:port).and_respond("421 Service not available, closing control connection.")
lambda { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPTempError)
-> { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 530" do
@server.should_receive(:eprt).and_respond("530 Not logged in.")
@server.should_receive(:port).and_respond("530 Not logged in.")
lambda { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPPermError)
-> { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPPermError)
end
end
end

View file

@ -28,26 +28,26 @@ describe "Net::FTP#site" do
it "does not raise an error when the response code is 202" do
@server.should_receive(:site).and_respond("202 Command not implemented, superfluous at this site.")
lambda { @ftp.site("param") }.should_not raise_error
-> { @ftp.site("param") }.should_not raise_error
end
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:site).and_respond("500 Syntax error, command unrecognized.")
lambda { @ftp.site("param") }.should raise_error(Net::FTPPermError)
-> { @ftp.site("param") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:site).and_respond("501 Syntax error in parameters or arguments.")
lambda { @ftp.site("param") }.should raise_error(Net::FTPPermError)
-> { @ftp.site("param") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:site).and_respond("421 Service not available, closing control connection.")
lambda { @ftp.site("param") }.should raise_error(Net::FTPTempError)
-> { @ftp.site("param") }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 530" do
@server.should_receive(:site).and_respond("530 Requested action not taken.")
lambda { @ftp.site("param") }.should raise_error(Net::FTPPermError)
-> { @ftp.site("param") }.should raise_error(Net::FTPPermError)
end
end

View file

@ -28,21 +28,21 @@ describe "Net::FTP#size" do
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:size).and_respond("500 Syntax error, command unrecognized.")
lambda { @ftp.size("test.file") }.should raise_error(Net::FTPPermError)
-> { @ftp.size("test.file") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:size).and_respond("501 Syntax error in parameters or arguments.")
lambda { @ftp.size("test.file") }.should raise_error(Net::FTPPermError)
-> { @ftp.size("test.file") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:size).and_respond("421 Service not available, closing control connection.")
lambda { @ftp.size("test.file") }.should raise_error(Net::FTPTempError)
-> { @ftp.size("test.file") }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 550" do
@server.should_receive(:size).and_respond("550 Requested action not taken.")
lambda { @ftp.size("test.file") }.should raise_error(Net::FTPPermError)
-> { @ftp.size("test.file") }.should raise_error(Net::FTPPermError)
end
end

View file

@ -32,36 +32,36 @@ describe "Net::FTP#status" do
it "does not raise an error when the response code is 212" do
@server.should_receive(:stat).and_respond("212 Directory status.")
lambda { @ftp.status }.should_not raise_error
-> { @ftp.status }.should_not raise_error
end
it "does not raise an error when the response code is 213" do
@server.should_receive(:stat).and_respond("213 File status.")
lambda { @ftp.status }.should_not raise_error
-> { @ftp.status }.should_not raise_error
end
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:stat).and_respond("500 Syntax error, command unrecognized.")
lambda { @ftp.status }.should raise_error(Net::FTPPermError)
-> { @ftp.status }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:stat).and_respond("501 Syntax error in parameters or arguments.")
lambda { @ftp.status }.should raise_error(Net::FTPPermError)
-> { @ftp.status }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 502" do
@server.should_receive(:stat).and_respond("502 Command not implemented.")
lambda { @ftp.status }.should raise_error(Net::FTPPermError)
-> { @ftp.status }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:stat).and_respond("421 Service not available, closing control connection.")
lambda { @ftp.status }.should raise_error(Net::FTPTempError)
-> { @ftp.status }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 530" do
@server.should_receive(:stat).and_respond("530 Requested action not taken.")
lambda { @ftp.status }.should raise_error(Net::FTPPermError)
-> { @ftp.status }.should raise_error(Net::FTPPermError)
end
end

View file

@ -28,21 +28,21 @@ describe "Net::FTP#system" do
it "raises a Net::FTPPermError when the response code is 500" do
@server.should_receive(:syst).and_respond("500 Syntax error, command unrecognized.")
lambda { @ftp.system }.should raise_error(Net::FTPPermError)
-> { @ftp.system }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 501" do
@server.should_receive(:syst).and_respond("501 Syntax error in parameters or arguments.")
lambda { @ftp.system }.should raise_error(Net::FTPPermError)
-> { @ftp.system }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPPermError when the response code is 502" do
@server.should_receive(:syst).and_respond("502 Command not implemented.")
lambda { @ftp.system }.should raise_error(Net::FTPPermError)
-> { @ftp.system }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPTempError when the response code is 421" do
@server.should_receive(:syst).and_respond("421 Service not available, closing control connection.")
lambda { @ftp.system }.should raise_error(Net::FTPTempError)
-> { @ftp.system }.should raise_error(Net::FTPTempError)
end
end

View file

@ -19,7 +19,7 @@ describe "Net::FTP#voidcmd" do
it "sends the passed command to the server" do
@server.should_receive(:help).and_respond("2xx Does not raise.")
lambda { @ftp.voidcmd("HELP") }.should_not raise_error
-> { @ftp.voidcmd("HELP") }.should_not raise_error
end
it "returns nil" do
@ -29,26 +29,26 @@ describe "Net::FTP#voidcmd" do
it "raises a Net::FTPReplyError when the response code is 1xx" do
@server.should_receive(:help).and_respond("1xx Does raise a Net::FTPReplyError.")
lambda { @ftp.voidcmd("HELP") }.should raise_error(Net::FTPReplyError)
-> { @ftp.voidcmd("HELP") }.should raise_error(Net::FTPReplyError)
end
it "raises a Net::FTPReplyError when the response code is 3xx" do
@server.should_receive(:help).and_respond("3xx Does raise a Net::FTPReplyError.")
lambda { @ftp.voidcmd("HELP") }.should raise_error(Net::FTPReplyError)
-> { @ftp.voidcmd("HELP") }.should raise_error(Net::FTPReplyError)
end
it "raises a Net::FTPTempError when the response code is 4xx" do
@server.should_receive(:help).and_respond("4xx Does raise a Net::FTPTempError.")
lambda { @ftp.voidcmd("HELP") }.should raise_error(Net::FTPTempError)
-> { @ftp.voidcmd("HELP") }.should raise_error(Net::FTPTempError)
end
it "raises a Net::FTPPermError when the response code is 5xx" do
@server.should_receive(:help).and_respond("5xx Does raise a Net::FTPPermError.")
lambda { @ftp.voidcmd("HELP") }.should raise_error(Net::FTPPermError)
-> { @ftp.voidcmd("HELP") }.should raise_error(Net::FTPPermError)
end
it "raises a Net::FTPProtoError when the response code is not valid" do
@server.should_receive(:help).and_respond("999 Does raise a Net::FTPProtoError.")
lambda { @ftp.voidcmd("HELP") }.should raise_error(Net::FTPProtoError)
-> { @ftp.voidcmd("HELP") }.should raise_error(Net::FTPProtoError)
end
end