Sha256: d3b82796bcb1583835adc8239fc34b5cf85cd5d10b13cb5712832d075861d7b0

Contents?: true

Size: 1.22 KB

Versions: 3

Compression:

Stored size: 1.22 KB

Contents

require File.dirname(File.join(__rhoGetCurrentDir(), __FILE__)) + '/../../../../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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rhodes-1.4.2 spec/framework_spec/app/spec/library/net/http/http/initialize_spec.rb
rhodes-1.4.1 spec/framework_spec/app/spec/library/net/http/http/initialize_spec.rb
rhodes-1.4.0 spec/framework_spec/app/spec/library/net/http/http/initialize_spec.rb