summaryrefslogtreecommitdiff
path: root/spec/ruby/library/net
diff options
context:
space:
mode:
authoreregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-20 21:50:14 +0000
committereregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-20 21:50:14 +0000
commit2dd35a74533e63ad2b9b8804ef62b153ac926978 (patch)
tree4503951c4706c6a5bd4ab27c4c424f40428b32ca /spec/ruby/library/net
parentaaf07f7ad5fa892911b2f5a5390cdfdb865d74d9 (diff)
Prefer adapting specs to complicating library code
* lib/net/ftp.rb (Net::FTP#initialize): simplify as per the original intent. * spec/ruby/library/net/ftp/initialize_spec.rb: adapt specs. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59981 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/ruby/library/net')
-rw-r--r--spec/ruby/library/net/ftp/initialize_spec.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/spec/ruby/library/net/ftp/initialize_spec.rb b/spec/ruby/library/net/ftp/initialize_spec.rb
index 767bbecedb..65105b8831 100644
--- a/spec/ruby/library/net/ftp/initialize_spec.rb
+++ b/spec/ruby/library/net/ftp/initialize_spec.rb
@@ -5,6 +5,10 @@ describe "Net::FTP#initialize" do
before :each do
@ftp = Net::FTP.allocate
@ftp.stub!(:connect)
+ @port_args = []
+ ruby_version_is "2.5" do
+ @port_args << 21
+ end
end
it "is private" do
@@ -44,14 +48,14 @@ describe "Net::FTP#initialize" do
describe "when passed host" do
it "tries to connect to the passed host" do
- @ftp.should_receive(:connect).with("localhost")
+ @ftp.should_receive(:connect).with("localhost", *@port_args)
@ftp.send(:initialize, "localhost")
end
end
describe "when passed host, user" do
it "tries to connect to the passed host" do
- @ftp.should_receive(:connect).with("localhost")
+ @ftp.should_receive(:connect).with("localhost", *@port_args)
@ftp.send(:initialize, "localhost")
end
@@ -63,7 +67,7 @@ describe "Net::FTP#initialize" do
describe "when passed host, user, password" do
it "tries to connect to the passed host" do
- @ftp.should_receive(:connect).with("localhost")
+ @ftp.should_receive(:connect).with("localhost", *@port_args)
@ftp.send(:initialize, "localhost")
end
@@ -75,7 +79,7 @@ describe "Net::FTP#initialize" do
describe "when passed host, user" do
it "tries to connect to the passed host" do
- @ftp.should_receive(:connect).with("localhost")
+ @ftp.should_receive(:connect).with("localhost", *@port_args)
@ftp.send(:initialize, "localhost")
end