diff --git a/Spec/RealtimeClient.swift b/Spec/RealtimeClient.swift index 63e66cf5e..50e742bfe 100644 --- a/Spec/RealtimeClient.swift +++ b/Spec/RealtimeClient.swift @@ -1328,54 +1328,29 @@ class RealtimeClient: QuickSpec { expect(result).to(equal(expectedOrder)) } - // Possible issue of https://github.com/ably/ably-ios/issues/640 - xit("should unlock queue when the timer ends") { - let options = ARTClientOptions(key: "xxxx:xxxx") - options.autoConnect = false - let client = ARTRealtime(options: options) - let channel = client.channels.get("foo") - - waitUntil(timeout: testTimeout) { done in - // Schedule a timer in the `internalDispatchQueue` - let listener = client.internalEventEmitter.once { _ in } - listener.setTimer(0.2, onTimeout: { - // another lock - channel.unsubscribe() - done() - }) - listener.startTimer() - - // lock - channel.unsubscribe() - } - } - class AblyManager { static let sharedClient = ARTRealtime(options: { $0.autoConnect = false; return $0 }(ARTClientOptions(key: "xxxx:xxxx"))) } - // Possible issue of https://github.com/ably/ably-ios/issues/640 - xit("should dispatch in user queue") { + // Issue https://github.com/ably/ably-ios/issues/640 + it("should dispatch in user queue when removing an observer") { class Foo { - let channel = "foo" init() { - AblyManager.sharedClient.channels.get(channel).subscribe { _ in + AblyManager.sharedClient.channels.get("foo").subscribe { _ in // keep reference self.update() } } - deinit { - close() - } func update() { } - func close() { - AblyManager.sharedClient.channels.get(channel).unsubscribe() + deinit { + AblyManager.sharedClient.channels.get("foo").unsubscribe() } } - let foo = Foo() - foo.close() + var foo: Foo? = Foo() + foo = nil + AblyManager.sharedClient.channels.get("foo").unsubscribe() } it("should never register any connection listeners for internal use with the public EventEmitter") {