|
1 | 1 | require_relative '../../spec_helper' |
2 | | -require_relative 'spec_helper' |
3 | | -require_relative 'fixtures/server' |
4 | 2 |
|
5 | | -describe "Net::FTP#abort" do |
6 | | - before :each do |
7 | | - @server = NetFTPSpecs::DummyFTP.new |
8 | | - @server.serve_once |
| 3 | +ruby_version_is ""..."4.1" do |
| 4 | + require_relative 'spec_helper' |
| 5 | + require_relative 'fixtures/server' |
9 | 6 |
|
10 | | - @ftp = Net::FTP.new |
11 | | - @ftp.connect(@server.hostname, @server.server_port) |
12 | | - end |
| 7 | + describe "Net::FTP#abort" do |
| 8 | + before :each do |
| 9 | + @server = NetFTPSpecs::DummyFTP.new |
| 10 | + @server.serve_once |
13 | 11 |
|
14 | | - after :each do |
15 | | - @ftp.quit rescue nil |
16 | | - @ftp.close |
17 | | - @server.stop |
18 | | - end |
| 12 | + @ftp = Net::FTP.new |
| 13 | + @ftp.connect(@server.hostname, @server.server_port) |
| 14 | + end |
19 | 15 |
|
20 | | - it "sends the ABOR command to the server" do |
21 | | - -> { @ftp.abort }.should_not raise_error |
22 | | - end |
| 16 | + after :each do |
| 17 | + @ftp.quit rescue nil |
| 18 | + @ftp.close |
| 19 | + @server.stop |
| 20 | + end |
23 | 21 |
|
24 | | - it "ignores the response" do |
25 | | - @ftp.abort |
26 | | - @ftp.last_response.should == "220 Dummy FTP Server ready!\n" |
27 | | - end |
| 22 | + it "sends the ABOR command to the server" do |
| 23 | + -> { @ftp.abort }.should_not raise_error |
| 24 | + end |
28 | 25 |
|
29 | | - it "returns the full response" do |
30 | | - @ftp.abort.should == "226 Closing data connection. (ABOR)\n" |
31 | | - end |
| 26 | + it "ignores the response" do |
| 27 | + @ftp.abort |
| 28 | + @ftp.last_response.should == "220 Dummy FTP Server ready!\n" |
| 29 | + end |
32 | 30 |
|
33 | | - it "does not raise any error when the response code is 225" do |
34 | | - @server.should_receive(:abor).and_respond("225 Data connection open; no transfer in progress.") |
35 | | - -> { @ftp.abort }.should_not raise_error |
36 | | - end |
| 31 | + it "returns the full response" do |
| 32 | + @ftp.abort.should == "226 Closing data connection. (ABOR)\n" |
| 33 | + end |
37 | 34 |
|
38 | | - it "does not raise any error when the response code is 226" do |
39 | | - @server.should_receive(:abor).and_respond("226 Closing data connection.") |
40 | | - -> { @ftp.abort }.should_not raise_error |
41 | | - end |
| 35 | + it "does not raise any error when the response code is 225" do |
| 36 | + @server.should_receive(:abor).and_respond("225 Data connection open; no transfer in progress.") |
| 37 | + -> { @ftp.abort }.should_not raise_error |
| 38 | + end |
42 | 39 |
|
43 | | - it "raises a Net::FTPProtoError when the response code is 500" do |
44 | | - @server.should_receive(:abor).and_respond("500 Syntax error, command unrecognized.") |
45 | | - -> { @ftp.abort }.should raise_error(Net::FTPProtoError) |
46 | | - end |
| 40 | + it "does not raise any error when the response code is 226" do |
| 41 | + @server.should_receive(:abor).and_respond("226 Closing data connection.") |
| 42 | + -> { @ftp.abort }.should_not raise_error |
| 43 | + end |
47 | 44 |
|
48 | | - it "raises a Net::FTPProtoError when the response code is 501" do |
49 | | - @server.should_receive(:abor).and_respond("501 Syntax error in parameters or arguments.") |
50 | | - -> { @ftp.abort }.should raise_error(Net::FTPProtoError) |
51 | | - end |
| 45 | + it "raises a Net::FTPProtoError when the response code is 500" do |
| 46 | + @server.should_receive(:abor).and_respond("500 Syntax error, command unrecognized.") |
| 47 | + -> { @ftp.abort }.should raise_error(Net::FTPProtoError) |
| 48 | + end |
52 | 49 |
|
53 | | - it "raises a Net::FTPProtoError when the response code is 502" do |
54 | | - @server.should_receive(:abor).and_respond("502 Command not implemented.") |
55 | | - -> { @ftp.abort }.should raise_error(Net::FTPProtoError) |
56 | | - end |
| 50 | + it "raises a Net::FTPProtoError when the response code is 501" do |
| 51 | + @server.should_receive(:abor).and_respond("501 Syntax error in parameters or arguments.") |
| 52 | + -> { @ftp.abort }.should raise_error(Net::FTPProtoError) |
| 53 | + end |
| 54 | + |
| 55 | + it "raises a Net::FTPProtoError when the response code is 502" do |
| 56 | + @server.should_receive(:abor).and_respond("502 Command not implemented.") |
| 57 | + -> { @ftp.abort }.should raise_error(Net::FTPProtoError) |
| 58 | + end |
57 | 59 |
|
58 | | - it "raises a Net::FTPProtoError when the response code is 421" do |
59 | | - @server.should_receive(:abor).and_respond("421 Service not available, closing control connection.") |
60 | | - -> { @ftp.abort }.should raise_error(Net::FTPProtoError) |
| 60 | + it "raises a Net::FTPProtoError when the response code is 421" do |
| 61 | + @server.should_receive(:abor).and_respond("421 Service not available, closing control connection.") |
| 62 | + -> { @ftp.abort }.should raise_error(Net::FTPProtoError) |
| 63 | + end |
61 | 64 | end |
62 | 65 | end |
0 commit comments