diff options
author | Hiroshi SHIBATA <[email protected]> | 2024-02-15 16:39:14 +0900 |
---|---|---|
committer | Hiroshi SHIBATA <[email protected]> | 2024-02-15 18:57:23 +0900 |
commit | 4a00fcbd92d6fbc5514e04c1de3a0540e84e996e (patch) | |
tree | b18a90d3867aa383b8ee832de0bb1307698d3fd1 /spec/ruby/library/net-http/http/initialize_spec.rb | |
parent | fa7529afd5566bab3d1db9bba6624122ffd1b4c8 (diff) |
Rename and restructured net/ftp and net/http examples
Diffstat (limited to 'spec/ruby/library/net-http/http/initialize_spec.rb')
-rw-r--r-- | spec/ruby/library/net-http/http/initialize_spec.rb | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/spec/ruby/library/net-http/http/initialize_spec.rb b/spec/ruby/library/net-http/http/initialize_spec.rb new file mode 100644 index 0000000000..78aa01e1aa --- /dev/null +++ b/spec/ruby/library/net-http/http/initialize_spec.rb @@ -0,0 +1,46 @@ +require_relative '../../../spec_helper' +require 'net/http' + +describe "Net::HTTP#initialize" do + it "is private" do + Net::HTTP.should have_private_instance_method(:initialize) + end + + describe "when passed address" do + before :each do + @net = Net::HTTP.allocate + @net.send(:initialize, "localhost") + end + + it "sets the new Net::HTTP instance's address to the passed address" do + @net.address.should == "localhost" + end + + it "sets the new Net::HTTP instance's port to the default HTTP port" do + @net.port.should eql(Net::HTTP.default_port) + end + + it "does not start the new Net::HTTP instance" do + @net.started?.should be_false + end + end + + describe "when passed address, port" do + before :each do + @net = Net::HTTP.allocate + @net.send(:initialize, "localhost", 3333) + end + + it "sets the new Net::HTTP instance's address to the passed address" do + @net.address.should == "localhost" + end + + it "sets the new Net::HTTP instance's port to the passed port" do + @net.port.should eql(3333) + end + + it "does not start the new Net::HTTP instance" do + @net.started?.should be_false + end + end +end |