Skip to content

Commit

Permalink
RTN17a: pending (#387)
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardopereira authored and tcard committed May 5, 2016
1 parent 0be3ece commit 997b281
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions Spec/RealtimeClientConnection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2489,6 +2489,46 @@ class RealtimeClientConnection: QuickSpec {
expect(NSRegularExpression.match(urlConnections[0].absoluteString, pattern: "//realtime.ably.io")).to(beTrue())
}

// RTN17a
pending("every connection is first attempted to the primary host realtime.ably.io") {
let options = ARTClientOptions(key: "xxxx:xxxx")
options.autoConnect = false
let client = ARTRealtime(options: options)
let channel = client.channels.get("test")

client.setTransportClass(TestProxyTransport.self)
TestProxyTransport.network = .HostUnreachable
defer { TestProxyTransport.network = nil }

var urlConnections = [NSURL]()
TestProxyTransport.networkConnectEvent = { url in
urlConnections.append(url)
TestProxyTransport.network = nil
}

client.connect()
defer { client.close() }

waitUntil(timeout: testTimeout) { done in
channel.publish(nil, data: "message") { error in
done()
}
}

client.connect()

waitUntil(timeout: testTimeout) { done in
channel.publish(nil, data: "message") { error in
done()
}
}

expect(urlConnections).to(haveCount(3))
expect(NSRegularExpression.match(urlConnections[0].absoluteString, pattern: "//realtime.ably.io")).to(beTrue())
expect(NSRegularExpression.match(urlConnections[1].absoluteString, pattern: "//[a-e].ably-realtime.com")).to(beTrue())
expect(NSRegularExpression.match(urlConnections[2].absoluteString, pattern: "//realtime.ably.io")).to(beTrue())
}

}

// RTN18
Expand Down

0 comments on commit 997b281

Please sign in to comment.