@@ -127,6 +127,17 @@ def initialize(*); end
127127 hosts = @client . __extract_hosts ( { :host => 'myhost' , :scheme => 'https' } )
128128 assert_equal 'myhost' , hosts [ 0 ] [ :host ]
129129 assert_equal 'https' , hosts [ 0 ] [ :scheme ]
130+ assert_nil hosts [ 0 ] [ :port ]
131+ end
132+
133+ should "extract from hash with a port passed as a string" do
134+ hosts = @client . __extract_hosts ( { :host => 'myhost' , :scheme => 'https' , :port => '443' } )
135+ assert_equal 443 , hosts [ 0 ] [ :port ]
136+ end
137+
138+ should "extract from hash with a port passed as an integer" do
139+ hosts = @client . __extract_hosts ( { :host => 'myhost' , :scheme => 'https' , :port => 443 } )
140+ assert_equal 443 , hosts [ 0 ] [ :port ]
130141 end
131142
132143 should "extract from Hashie::Mash" do
@@ -154,10 +165,10 @@ def initialize(*); end
154165 assert_equal 2 , hosts . size
155166
156167 assert_equal 'host1' , hosts [ 0 ] [ :host ]
157- assert_equal ' 1000' , hosts [ 0 ] [ :port ]
168+ assert_equal 1000 , hosts [ 0 ] [ :port ]
158169
159170 assert_equal 'host2' , hosts [ 1 ] [ :host ]
160- assert_equal ' 2000' , hosts [ 1 ] [ :port ]
171+ assert_equal 2000 , hosts [ 1 ] [ :port ]
161172 end
162173
163174 should "extract path" do
@@ -171,7 +182,7 @@ def initialize(*); end
171182
172183 assert_equal 'https' , hosts [ 0 ] [ :scheme ]
173184 assert_equal 'myhost' , hosts [ 0 ] [ :host ]
174- assert_equal ' 8080' , hosts [ 0 ] [ :port ]
185+ assert_equal 8080 , hosts [ 0 ] [ :port ]
175186 end
176187
177188 should "extract credentials" do
@@ -181,14 +192,14 @@ def initialize(*); end
181192 assert_equal 'USERNAME' , hosts [ 0 ] [ :user ]
182193 assert_equal 'PASSWORD' , hosts [ 0 ] [ :password ]
183194 assert_equal 'myhost' , hosts [ 0 ] [ :host ]
184- assert_equal ' 8080' , hosts [ 0 ] [ :port ]
195+ assert_equal 8080 , hosts [ 0 ] [ :port ]
185196 end
186197
187198 should "pass hashes over" do
188199 hosts = @client . __extract_hosts [ { :host => 'myhost' , :port => '1000' , :foo => 'bar' } ]
189200
190201 assert_equal 'myhost' , hosts [ 0 ] [ :host ]
191- assert_equal ' 1000' , hosts [ 0 ] [ :port ]
202+ assert_equal 1000 , hosts [ 0 ] [ :port ]
192203 assert_equal 'bar' , hosts [ 0 ] [ :foo ]
193204 end
194205
@@ -200,7 +211,7 @@ def initialize(*); end
200211 assert_equal 'USERNAME' , hosts [ 0 ] [ :user ]
201212 assert_equal 'PASSWORD' , hosts [ 0 ] [ :password ]
202213 assert_equal 'myhost' , hosts [ 0 ] [ :host ]
203- assert_equal ' 4430' , hosts [ 0 ] [ :port ]
214+ assert_equal 4430 , hosts [ 0 ] [ :port ]
204215 end
205216
206217 should "split comma-separated URLs" do
0 commit comments