Skip to content

Commit 0557d87

Browse files
hsbtandrykonchin
authored andcommitted
spec/mspec/tool/wrap_with_guard.rb 'ruby_version_is ""..."4.1"' spec/ruby/library/net-ftp/**/*.rb
1 parent 5d79d54 commit 0557d87

65 files changed

Lines changed: 2829 additions & 2643 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

library/net-ftp/FTPError_spec.rb

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
require_relative '../../spec_helper'
2-
require 'net/ftp'
32

4-
describe "Net::FTPError" do
5-
it "is an Exception" do
6-
Net::FTPError.should < Exception
3+
ruby_version_is ""..."4.1" do
4+
require 'net/ftp'
5+
6+
describe "Net::FTPError" do
7+
it "is an Exception" do
8+
Net::FTPError.should < Exception
9+
end
710
end
811
end
Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
require_relative '../../spec_helper'
2-
require 'net/ftp'
32

4-
describe "Net::FTPPermError" do
5-
it "is an Exception" do
6-
Net::FTPPermError.should < Exception
7-
end
3+
ruby_version_is ""..."4.1" do
4+
require 'net/ftp'
5+
6+
describe "Net::FTPPermError" do
7+
it "is an Exception" do
8+
Net::FTPPermError.should < Exception
9+
end
810

9-
it "is a subclass of Net::FTPError" do
10-
Net::FTPPermError.should < Net::FTPError
11+
it "is a subclass of Net::FTPError" do
12+
Net::FTPPermError.should < Net::FTPError
13+
end
1114
end
1215
end
Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
require_relative '../../spec_helper'
2-
require 'net/ftp'
32

4-
describe "Net::FTPProtoError" do
5-
it "is an Exception" do
6-
Net::FTPProtoError.should < Exception
7-
end
3+
ruby_version_is ""..."4.1" do
4+
require 'net/ftp'
5+
6+
describe "Net::FTPProtoError" do
7+
it "is an Exception" do
8+
Net::FTPProtoError.should < Exception
9+
end
810

9-
it "is a subclass of Net::FTPError" do
10-
Net::FTPPermError.should < Net::FTPError
11+
it "is a subclass of Net::FTPError" do
12+
Net::FTPPermError.should < Net::FTPError
13+
end
1114
end
1215
end
Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
require_relative '../../spec_helper'
2-
require 'net/ftp'
32

4-
describe "Net::FTPReplyError" do
5-
it "is an Exception" do
6-
Net::FTPReplyError.should < Exception
7-
end
3+
ruby_version_is ""..."4.1" do
4+
require 'net/ftp'
5+
6+
describe "Net::FTPReplyError" do
7+
it "is an Exception" do
8+
Net::FTPReplyError.should < Exception
9+
end
810

9-
it "is a subclass of Net::FTPError" do
10-
Net::FTPPermError.should < Net::FTPError
11+
it "is a subclass of Net::FTPError" do
12+
Net::FTPPermError.should < Net::FTPError
13+
end
1114
end
1215
end
Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
require_relative '../../spec_helper'
2-
require 'net/ftp'
32

4-
describe "Net::FTPTempError" do
5-
it "is an Exception" do
6-
Net::FTPTempError.should < Exception
7-
end
3+
ruby_version_is ""..."4.1" do
4+
require 'net/ftp'
5+
6+
describe "Net::FTPTempError" do
7+
it "is an Exception" do
8+
Net::FTPTempError.should < Exception
9+
end
810

9-
it "is a subclass of Net::FTPError" do
10-
Net::FTPPermError.should < Net::FTPError
11+
it "is a subclass of Net::FTPError" do
12+
Net::FTPPermError.should < Net::FTPError
13+
end
1114
end
1215
end

library/net-ftp/abort_spec.rb

Lines changed: 50 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,65 @@
11
require_relative '../../spec_helper'
2-
require_relative 'spec_helper'
3-
require_relative 'fixtures/server'
42

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'
96

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
1311

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
1915

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
2321

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
2825

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
3230

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
3734

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
4239

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
4744

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
5249

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
5759

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
6164
end
6265
end

library/net-ftp/acct_spec.rb

Lines changed: 57 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,61 @@
11
require_relative '../../spec_helper'
2-
require_relative 'spec_helper'
3-
require_relative 'fixtures/server'
42

5-
describe "Net::FTP#acct" do
6-
before :each do
7-
@server = NetFTPSpecs::DummyFTP.new
8-
@server.serve_once
9-
10-
@ftp = Net::FTP.new
11-
@ftp.connect(@server.hostname, @server.server_port)
12-
end
13-
14-
after :each do
15-
@ftp.quit rescue nil
16-
@ftp.close
17-
@server.stop
18-
end
19-
20-
it "writes the ACCT command to the server" do
21-
@ftp.acct("my_account")
22-
@ftp.last_response.should == "230 User 'my_account' logged in, proceed. (ACCT)\n"
23-
end
24-
25-
it "returns nil" do
26-
@ftp.acct("my_account").should == nil
27-
end
28-
29-
it "does not raise any error when the response code is 230" do
30-
@server.should_receive(:acct).and_respond("230 User logged in, proceed.")
31-
-> { @ftp.acct("my_account") }.should_not raise_error
32-
end
33-
34-
it "raises a Net::FTPPermError when the response code is 530" do
35-
@server.should_receive(:acct).and_respond("530 Not logged in.")
36-
-> { @ftp.acct("my_account") }.should raise_error(Net::FTPPermError)
37-
end
38-
39-
it "raises a Net::FTPPermError when the response code is 500" do
40-
@server.should_receive(:acct).and_respond("500 Syntax error, command unrecognized.")
41-
-> { @ftp.acct("my_account") }.should raise_error(Net::FTPPermError)
42-
end
43-
44-
it "raises a Net::FTPPermError when the response code is 501" do
45-
@server.should_receive(:acct).and_respond("501 Syntax error in parameters or arguments.")
46-
-> { @ftp.acct("my_account") }.should raise_error(Net::FTPPermError)
47-
end
48-
49-
it "raises a Net::FTPPermError when the response code is 503" do
50-
@server.should_receive(:acct).and_respond("503 Bad sequence of commands.")
51-
-> { @ftp.acct("my_account") }.should raise_error(Net::FTPPermError)
52-
end
53-
54-
it "raises a Net::FTPTempError when the response code is 421" do
55-
@server.should_receive(:acct).and_respond("421 Service not available, closing control connection.")
56-
-> { @ftp.acct("my_account") }.should raise_error(Net::FTPTempError)
3+
ruby_version_is ""..."4.1" do
4+
require_relative 'spec_helper'
5+
require_relative 'fixtures/server'
6+
7+
describe "Net::FTP#acct" do
8+
before :each do
9+
@server = NetFTPSpecs::DummyFTP.new
10+
@server.serve_once
11+
12+
@ftp = Net::FTP.new
13+
@ftp.connect(@server.hostname, @server.server_port)
14+
end
15+
16+
after :each do
17+
@ftp.quit rescue nil
18+
@ftp.close
19+
@server.stop
20+
end
21+
22+
it "writes the ACCT command to the server" do
23+
@ftp.acct("my_account")
24+
@ftp.last_response.should == "230 User 'my_account' logged in, proceed. (ACCT)\n"
25+
end
26+
27+
it "returns nil" do
28+
@ftp.acct("my_account").should == nil
29+
end
30+
31+
it "does not raise any error when the response code is 230" do
32+
@server.should_receive(:acct).and_respond("230 User logged in, proceed.")
33+
-> { @ftp.acct("my_account") }.should_not raise_error
34+
end
35+
36+
it "raises a Net::FTPPermError when the response code is 530" do
37+
@server.should_receive(:acct).and_respond("530 Not logged in.")
38+
-> { @ftp.acct("my_account") }.should raise_error(Net::FTPPermError)
39+
end
40+
41+
it "raises a Net::FTPPermError when the response code is 500" do
42+
@server.should_receive(:acct).and_respond("500 Syntax error, command unrecognized.")
43+
-> { @ftp.acct("my_account") }.should raise_error(Net::FTPPermError)
44+
end
45+
46+
it "raises a Net::FTPPermError when the response code is 501" do
47+
@server.should_receive(:acct).and_respond("501 Syntax error in parameters or arguments.")
48+
-> { @ftp.acct("my_account") }.should raise_error(Net::FTPPermError)
49+
end
50+
51+
it "raises a Net::FTPPermError when the response code is 503" do
52+
@server.should_receive(:acct).and_respond("503 Bad sequence of commands.")
53+
-> { @ftp.acct("my_account") }.should raise_error(Net::FTPPermError)
54+
end
55+
56+
it "raises a Net::FTPTempError when the response code is 421" do
57+
@server.should_receive(:acct).and_respond("421 Service not available, closing control connection.")
58+
-> { @ftp.acct("my_account") }.should raise_error(Net::FTPTempError)
59+
end
5760
end
5861
end

library/net-ftp/binary_spec.rb

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
11
require_relative '../../spec_helper'
2-
require_relative 'spec_helper'
32

4-
describe "Net::FTP#binary" do
5-
it "returns true when self is in binary mode" do
6-
ftp = Net::FTP.new
7-
ftp.binary.should be_true
3+
ruby_version_is ""..."4.1" do
4+
require_relative 'spec_helper'
85

9-
ftp.binary = false
10-
ftp.binary.should be_false
6+
describe "Net::FTP#binary" do
7+
it "returns true when self is in binary mode" do
8+
ftp = Net::FTP.new
9+
ftp.binary.should be_true
10+
11+
ftp.binary = false
12+
ftp.binary.should be_false
13+
end
1114
end
12-
end
1315

14-
describe "Net::FTP#binary=" do
15-
it "sets self to binary mode when passed true" do
16-
ftp = Net::FTP.new
16+
describe "Net::FTP#binary=" do
17+
it "sets self to binary mode when passed true" do
18+
ftp = Net::FTP.new
1719

18-
ftp.binary = true
19-
ftp.binary.should be_true
20+
ftp.binary = true
21+
ftp.binary.should be_true
2022

21-
ftp.binary = false
22-
ftp.binary.should be_false
23+
ftp.binary = false
24+
ftp.binary.should be_false
25+
end
2326
end
2427
end

0 commit comments

Comments
 (0)