@@ -40,7 +40,7 @@ public class MockWebSocket: WebSocket {
4040 }
4141 )
4242 }
43-
43+
4444 override public func disconnect( forceTimeout: Int = 0 ) {
4545 stubber. stub (
4646 " disconnect " ,
@@ -223,7 +223,7 @@ class PusherClientInitializationSpec: QuickSpec {
223223
224224 context ( " with default config " ) {
225225 it ( " has the correct conection url " ) {
226- expect ( pusher. connection. url) . to ( equal ( " wss://ws.pusherapp.com:443/app/testKey123?client=pusher-swift&version=0.1.4&protocol=7 " ) )
226+ expect ( pusher. connection. url) . to ( equal ( " wss://ws.pusherapp.com:443/app/testKey123?client=pusher-websocket- swift&version=0.1.4&protocol=7 " ) )
227227 }
228228
229229 it ( " has auth endpoint as nil " ) {
@@ -245,17 +245,25 @@ class PusherClientInitializationSpec: QuickSpec {
245245 it ( " has auth method of none " ) {
246246 expect ( pusher. connection. options. authMethod) . to ( equal ( AuthMethod . NoMethod) )
247247 }
248-
248+
249249 it ( " has authRequestCustomizer as nil " ) {
250250 expect ( pusher. connection. options. authRequestCustomizer) . to ( beNil ( ) )
251251 }
252+
253+ it ( " has the host set correctly " ) {
254+ expect ( pusher. connection. options. host) . to ( equal ( " ws.pusherapp.com " ) )
255+ }
256+
257+ it ( " has the port set as nil " ) {
258+ expect ( pusher. connection. options. port) . to ( beNil ( ) )
259+ }
252260 }
253261
254262 context ( " passing in configuration options " ) {
255263 context ( " unencrypted " ) {
256264 it ( " has the correct conection url " ) {
257265 pusher = Pusher ( key: key, options: [ " encrypted " : false ] )
258- expect ( pusher. connection. url) . to ( equal ( " ws://ws.pusherapp.com:80/app/testKey123?client=pusher-swift&version=0.1.4&protocol=7 " ) )
266+ expect ( pusher. connection. url) . to ( equal ( " ws://ws.pusherapp.com:80/app/testKey123?client=pusher-websocket- swift&version=0.1.4&protocol=7 " ) )
259267 }
260268 }
261269
@@ -289,7 +297,7 @@ class PusherClientInitializationSpec: QuickSpec {
289297 expect ( pusher. connection. options. attemptToReturnJSONObject) . to ( beFalsy ( ) )
290298 }
291299 }
292-
300+
293301 context ( " an authRequestCustomizer " ) {
294302 it ( " has one set " ) {
295303 func customizer( request: NSMutableURLRequest ) -> NSMutableURLRequest {
@@ -299,6 +307,20 @@ class PusherClientInitializationSpec: QuickSpec {
299307 expect ( pusher. connection. options. authRequestCustomizer) . toNot ( beNil ( ) )
300308 }
301309 }
310+
311+ context ( " a host " ) {
312+ it ( " has one set " ) {
313+ pusher = Pusher ( key: key, options: [ " host " : " test.test.test " ] )
314+ expect ( pusher. connection. options. host) . to ( equal ( " test.test.test " ) )
315+ }
316+ }
317+
318+ context ( " a port " ) {
319+ it ( " sets the URL with it " ) {
320+ pusher = Pusher ( key: key, options: [ " port " : 123 ] )
321+ expect ( pusher. connection. options. port) . to ( equal ( 123 ) )
322+ }
323+ }
302324 }
303325 }
304326 }
@@ -682,7 +704,7 @@ class MockSession: NSURLSession {
682704 override class func sharedSession( ) -> NSURLSession {
683705 return MockSession ( )
684706 }
685-
707+
686708 override func dataTaskWithRequest( request: NSURLRequest , completionHandler: ( NSData ? , NSURLResponse ? , NSError ? ) -> Void ) -> NSURLSessionDataTask {
687709 self . completionHandler = completionHandler
688710 return MockTask ( response: MockSession . mockResponse, completionHandler: completionHandler)
0 commit comments