mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Update to ruby/spec@875a09e
This commit is contained in:
parent
a06301b103
commit
5c276e1cc9
1247 changed files with 5316 additions and 5028 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
##
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -16,11 +16,11 @@ end
|
|||
ruby_version_is "2.6" do
|
||||
describe "Net::HTTPServerException" do
|
||||
it "is a subclass of Net::ProtoServerError and is warned as deprecated" do
|
||||
lambda { Net::HTTPServerException.should < Net::ProtoServerError }.should complain(/warning: constant Net::HTTPServerException is deprecated/)
|
||||
-> { Net::HTTPServerException.should < Net::ProtoServerError }.should complain(/warning: constant Net::HTTPServerException is deprecated/)
|
||||
end
|
||||
|
||||
it "includes the Net::HTTPExceptions module and is warned as deprecated" do
|
||||
lambda { Net::HTTPServerException.should < Net::HTTPExceptions }.should complain(/warning: constant Net::HTTPServerException is deprecated/)
|
||||
-> { Net::HTTPServerException.should < Net::HTTPExceptions }.should complain(/warning: constant Net::HTTPServerException is deprecated/)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -23,7 +23,7 @@ describe "Net::HTTP#finish" do
|
|||
|
||||
describe "when self has not been started yet" do
|
||||
it "raises an IOError" do
|
||||
lambda { @http.finish }.should raise_error(IOError)
|
||||
-> { @http.finish }.should raise_error(IOError)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -14,7 +14,7 @@ describe "Net::HTTP.get_print" do
|
|||
|
||||
describe "when passed URI" do
|
||||
it "it prints the body of the specified uri to $stdout" do
|
||||
lambda do
|
||||
-> do
|
||||
Net::HTTP.get_print URI.parse("http://localhost:#{@port}/")
|
||||
end.should output(/This is the index page\./)
|
||||
end
|
||||
|
@ -22,7 +22,7 @@ describe "Net::HTTP.get_print" do
|
|||
|
||||
describe "when passed host, path, port" do
|
||||
it "it prints the body of the specified uri to $stdout" do
|
||||
lambda do
|
||||
-> do
|
||||
Net::HTTP.get_print 'localhost', "/", @port
|
||||
end.should output(/This is the index page\./)
|
||||
end
|
||||
|
|
|
@ -28,6 +28,6 @@ describe "Net::HTTP#set_debug_output when passed io" do
|
|||
|
||||
it "outputs a warning when the connection has already been started" do
|
||||
@http.start
|
||||
lambda { @http.set_debug_output(StringIO.new) }.should complain(/Net::HTTP#set_debug_output called after HTTP started/)
|
||||
-> { @http.set_debug_output(StringIO.new) }.should complain(/Net::HTTP#set_debug_output called after HTTP started/)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -81,7 +81,7 @@ describe "Net::HTTP#start" do
|
|||
describe "when self has already been started" do
|
||||
it "raises an IOError" do
|
||||
@http.start
|
||||
lambda { @http.start }.should raise_error(IOError)
|
||||
-> { @http.start }.should raise_error(IOError)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ describe "Net::HTTPGenericRequest#body_exist?" do
|
|||
describe "when $VERBOSE is true" do
|
||||
it "emits a warning" do
|
||||
request = Net::HTTPGenericRequest.new("POST", true, false, "/some/path")
|
||||
lambda {
|
||||
-> {
|
||||
request.body_exist?
|
||||
}.should complain(/body_exist\? is obsolete/, verbose: true)
|
||||
end
|
||||
|
|
|
@ -125,7 +125,7 @@ describe "Net::HTTPGenericRequest#exec when passed socket, version, path" do
|
|||
"Content-Type" => "text/html")
|
||||
request.body_stream = StringIO.new("Some Content")
|
||||
|
||||
lambda { request.exec(@buffered_socket, "1.1", "/some/other/path") }.should raise_error(ArgumentError)
|
||||
-> { request.exec(@buffered_socket, "1.1", "/some/other/path") }.should raise_error(ArgumentError)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -13,9 +13,9 @@ describe "Net::HTTPGenericRequest#set_body_internal when passed string" do
|
|||
|
||||
it "raises an ArgumentError when the body or body_stream of self have already been set" do
|
||||
@request.body = "Some Content"
|
||||
lambda { @request.set_body_internal("Some other Content") }.should raise_error(ArgumentError)
|
||||
-> { @request.set_body_internal("Some other Content") }.should raise_error(ArgumentError)
|
||||
|
||||
@request.body_stream = "Some Content"
|
||||
lambda { @request.set_body_internal("Some other Content") }.should raise_error(ArgumentError)
|
||||
-> { @request.set_body_internal("Some other Content") }.should raise_error(ArgumentError)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -13,7 +13,7 @@ describe "Net::HTTPHeader#content_length" do
|
|||
|
||||
it "raises a Net::HTTPHeaderSyntaxError when the 'Content-Length' header entry has an invalid format" do
|
||||
@headers["Content-Length"] = "invalid"
|
||||
lambda { @headers.content_length }.should raise_error(Net::HTTPHeaderSyntaxError)
|
||||
-> { @headers.content_length }.should raise_error(Net::HTTPHeaderSyntaxError)
|
||||
end
|
||||
|
||||
it "returns the value of the 'Content-Length' header entry as an Integer" do
|
||||
|
|
|
@ -21,12 +21,12 @@ describe "Net::HTTPHeader#content_range" do
|
|||
|
||||
it "raises a Net::HTTPHeaderSyntaxError when the 'Content-Range' has an invalid format" do
|
||||
@headers["Content-Range"] = "invalid"
|
||||
lambda { @headers.content_range }.should raise_error(Net::HTTPHeaderSyntaxError)
|
||||
-> { @headers.content_range }.should raise_error(Net::HTTPHeaderSyntaxError)
|
||||
|
||||
@headers["Content-Range"] = "bytes 123-abc"
|
||||
lambda { @headers.content_range }.should raise_error(Net::HTTPHeaderSyntaxError)
|
||||
-> { @headers.content_range }.should raise_error(Net::HTTPHeaderSyntaxError)
|
||||
|
||||
@headers["Content-Range"] = "bytes abc-123"
|
||||
lambda { @headers.content_range }.should raise_error(Net::HTTPHeaderSyntaxError)
|
||||
-> { @headers.content_range }.should raise_error(Net::HTTPHeaderSyntaxError)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -25,7 +25,7 @@ describe "Net::HTTPHeader#fetch" do
|
|||
end
|
||||
|
||||
it "returns nil when there is no entry for the passed key" do
|
||||
lambda { @headers.fetch("my-header") }.should raise_error(IndexError)
|
||||
-> { @headers.fetch("my-header") }.should raise_error(IndexError)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ describe "Net::HTTPHeader#initialize_http_header when passed Hash" do
|
|||
end
|
||||
|
||||
it "complains about duplicate keys when in verbose mode" do
|
||||
lambda do
|
||||
-> do
|
||||
@headers.initialize_http_header("My-Header" => "test", "my-header" => "another test")
|
||||
end.should complain(/duplicated HTTP header/, verbose: true)
|
||||
end
|
||||
|
|
|
@ -21,12 +21,12 @@ describe "Net::HTTPHeader#range_length" do
|
|||
|
||||
it "raises a Net::HTTPHeaderSyntaxError when the 'Content-Range' has an invalid format" do
|
||||
@headers["Content-Range"] = "invalid"
|
||||
lambda { @headers.range_length }.should raise_error(Net::HTTPHeaderSyntaxError)
|
||||
-> { @headers.range_length }.should raise_error(Net::HTTPHeaderSyntaxError)
|
||||
|
||||
@headers["Content-Range"] = "bytes 123-abc"
|
||||
lambda { @headers.range_length }.should raise_error(Net::HTTPHeaderSyntaxError)
|
||||
-> { @headers.range_length }.should raise_error(Net::HTTPHeaderSyntaxError)
|
||||
|
||||
@headers["Content-Range"] = "bytes abc-123"
|
||||
lambda { @headers.range_length }.should raise_error(Net::HTTPHeaderSyntaxError)
|
||||
-> { @headers.range_length }.should raise_error(Net::HTTPHeaderSyntaxError)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -28,18 +28,18 @@ describe "Net::HTTPHeader#range" do
|
|||
|
||||
it "raises a Net::HTTPHeaderSyntaxError when the 'Range' has an invalid format" do
|
||||
@headers["Range"] = "invalid"
|
||||
lambda { @headers.range }.should raise_error(Net::HTTPHeaderSyntaxError)
|
||||
-> { @headers.range }.should raise_error(Net::HTTPHeaderSyntaxError)
|
||||
|
||||
@headers["Range"] = "bytes 123-abc"
|
||||
lambda { @headers.range }.should raise_error(Net::HTTPHeaderSyntaxError)
|
||||
-> { @headers.range }.should raise_error(Net::HTTPHeaderSyntaxError)
|
||||
|
||||
@headers["Range"] = "bytes abc-123"
|
||||
lambda { @headers.range }.should raise_error(Net::HTTPHeaderSyntaxError)
|
||||
-> { @headers.range }.should raise_error(Net::HTTPHeaderSyntaxError)
|
||||
end
|
||||
|
||||
it "raises a Net::HTTPHeaderSyntaxError when the 'Range' was not specified" do
|
||||
@headers["Range"] = "bytes=-"
|
||||
lambda { @headers.range }.should raise_error(Net::HTTPHeaderSyntaxError)
|
||||
-> { @headers.range }.should raise_error(Net::HTTPHeaderSyntaxError)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -50,15 +50,15 @@ describe :net_httpheader_set_range, shared: true do
|
|||
end
|
||||
|
||||
it "raises a Net::HTTPHeaderSyntaxError when the first Range element is negative" do
|
||||
lambda { @headers.send(@method, -10..5) }.should raise_error(Net::HTTPHeaderSyntaxError)
|
||||
-> { @headers.send(@method, -10..5) }.should raise_error(Net::HTTPHeaderSyntaxError)
|
||||
end
|
||||
|
||||
it "raises a Net::HTTPHeaderSyntaxError when the last Range element is negative" do
|
||||
lambda { @headers.send(@method, 10..-5) }.should raise_error(Net::HTTPHeaderSyntaxError)
|
||||
-> { @headers.send(@method, 10..-5) }.should raise_error(Net::HTTPHeaderSyntaxError)
|
||||
end
|
||||
|
||||
it "raises a Net::HTTPHeaderSyntaxError when the last Range element is smaller than the first" do
|
||||
lambda { @headers.send(@method, 10..5) }.should raise_error(Net::HTTPHeaderSyntaxError)
|
||||
-> { @headers.send(@method, 10..5) }.should raise_error(Net::HTTPHeaderSyntaxError)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -75,15 +75,15 @@ describe :net_httpheader_set_range, shared: true do
|
|||
end
|
||||
|
||||
it "raises a Net::HTTPHeaderSyntaxError when start is negative" do
|
||||
lambda { @headers.send(@method, -10, 5) }.should raise_error(Net::HTTPHeaderSyntaxError)
|
||||
-> { @headers.send(@method, -10, 5) }.should raise_error(Net::HTTPHeaderSyntaxError)
|
||||
end
|
||||
|
||||
it "raises a Net::HTTPHeaderSyntaxError when start + length is negative" do
|
||||
lambda { @headers.send(@method, 10, -15) }.should raise_error(Net::HTTPHeaderSyntaxError)
|
||||
-> { @headers.send(@method, 10, -15) }.should raise_error(Net::HTTPHeaderSyntaxError)
|
||||
end
|
||||
|
||||
it "raises a Net::HTTPHeaderSyntaxError when length is negative" do
|
||||
lambda { @headers.send(@method, 10, -4) }.should raise_error(Net::HTTPHeaderSyntaxError)
|
||||
-> { @headers.send(@method, 10, -4) }.should raise_error(Net::HTTPHeaderSyntaxError)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,26 +4,26 @@ require 'net/http'
|
|||
describe "Net::HTTPResponse#error!" do
|
||||
it "raises self's class 'EXCEPTION_TYPE' Exception" do
|
||||
res = Net::HTTPUnknownResponse.new("1.0", "???", "test response")
|
||||
lambda { res.error! }.should raise_error(Net::HTTPError)
|
||||
-> { res.error! }.should raise_error(Net::HTTPError)
|
||||
|
||||
res = Net::HTTPInformation.new("1.0", "1xx", "test response")
|
||||
lambda { res.error! }.should raise_error(Net::HTTPError)
|
||||
-> { res.error! }.should raise_error(Net::HTTPError)
|
||||
|
||||
res = Net::HTTPSuccess.new("1.0", "2xx", "test response")
|
||||
lambda { res.error! }.should raise_error(Net::HTTPError)
|
||||
-> { res.error! }.should raise_error(Net::HTTPError)
|
||||
|
||||
res = Net::HTTPRedirection.new("1.0", "3xx", "test response")
|
||||
lambda { res.error! }.should raise_error(Net::HTTPRetriableError)
|
||||
-> { res.error! }.should raise_error(Net::HTTPRetriableError)
|
||||
|
||||
res = Net::HTTPClientError.new("1.0", "4xx", "test response")
|
||||
ruby_version_is ""..."2.6" do
|
||||
lambda { res.error! }.should raise_error(Net::HTTPServerException)
|
||||
-> { res.error! }.should raise_error(Net::HTTPServerException)
|
||||
end
|
||||
ruby_version_is "2.6" do
|
||||
lambda { res.error! }.should raise_error(Net::HTTPClientException)
|
||||
-> { res.error! }.should raise_error(Net::HTTPClientException)
|
||||
end
|
||||
|
||||
res = Net::HTTPServerError.new("1.0", "5xx", "test response")
|
||||
lambda { res.error! }.should raise_error(Net::HTTPFatalError)
|
||||
-> { res.error! }.should raise_error(Net::HTTPFatalError)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -40,7 +40,7 @@ describe "Net::HTTPResponse#read_body" do
|
|||
it "raises an IOError if called a second time" do
|
||||
@res.reading_body(@socket, true) do
|
||||
@res.read_body("")
|
||||
lambda { @res.read_body("") }.should raise_error(IOError)
|
||||
-> { @res.read_body("") }.should raise_error(IOError)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -70,7 +70,7 @@ describe "Net::HTTPResponse#read_body" do
|
|||
it "raises an IOError if called a second time" do
|
||||
@res.reading_body(@socket, true) do
|
||||
@res.read_body {}
|
||||
lambda { @res.read_body {} }.should raise_error(IOError)
|
||||
-> { @res.read_body {} }.should raise_error(IOError)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -78,7 +78,7 @@ describe "Net::HTTPResponse#read_body" do
|
|||
describe "when passed buffer and block" do
|
||||
it "raises an ArgumentError" do
|
||||
@res.reading_body(@socket, true) do
|
||||
lambda { @res.read_body("") {} }.should raise_error(ArgumentError)
|
||||
-> { @res.read_body("") {} }.should raise_error(ArgumentError)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,26 +4,26 @@ require 'net/http'
|
|||
describe "Net::HTTPResponse#value" do
|
||||
it "raises an HTTP error for non 2xx HTTP Responses" do
|
||||
res = Net::HTTPUnknownResponse.new("1.0", "???", "test response")
|
||||
lambda { res.value }.should raise_error(Net::HTTPError)
|
||||
-> { res.value }.should raise_error(Net::HTTPError)
|
||||
|
||||
res = Net::HTTPInformation.new("1.0", "1xx", "test response")
|
||||
lambda { res.value }.should raise_error(Net::HTTPError)
|
||||
-> { res.value }.should raise_error(Net::HTTPError)
|
||||
|
||||
res = Net::HTTPSuccess.new("1.0", "2xx", "test response")
|
||||
lambda { res.value }.should_not raise_error(Net::HTTPError)
|
||||
-> { res.value }.should_not raise_error(Net::HTTPError)
|
||||
|
||||
res = Net::HTTPRedirection.new("1.0", "3xx", "test response")
|
||||
lambda { res.value }.should raise_error(Net::HTTPRetriableError)
|
||||
-> { res.value }.should raise_error(Net::HTTPRetriableError)
|
||||
|
||||
res = Net::HTTPClientError.new("1.0", "4xx", "test response")
|
||||
ruby_version_is ""..."2.6" do
|
||||
lambda { res.value }.should raise_error(Net::HTTPServerException)
|
||||
-> { res.value }.should raise_error(Net::HTTPServerException)
|
||||
end
|
||||
ruby_version_is "2.6" do
|
||||
lambda { res.value }.should raise_error(Net::HTTPClientException)
|
||||
-> { res.value }.should raise_error(Net::HTTPClientException)
|
||||
end
|
||||
|
||||
res = Net::HTTPServerError.new("1.0", "5xx", "test response")
|
||||
lambda { res.value }.should raise_error(Net::HTTPFatalError)
|
||||
-> { res.value }.should raise_error(Net::HTTPFatalError)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue