From ad2f543e15e1e63409dca3ac3683c2b308e88e8e Mon Sep 17 00:00:00 2001 From: Ricardo Pereira Date: Mon, 28 Nov 2016 18:49:10 +0000 Subject: [PATCH] RTL5j --- Spec/RealtimeClientChannel.swift | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/Spec/RealtimeClientChannel.swift b/Spec/RealtimeClientChannel.swift index dd75060a6..36d3eeb99 100644 --- a/Spec/RealtimeClientChannel.swift +++ b/Spec/RealtimeClientChannel.swift @@ -953,6 +953,32 @@ class RealtimeClientChannel: QuickSpec { } } + // RTL5j + it("if the channel state is SUSPENDED, the @detach@ request transitions the channel immediately to the DETACHED state") { + let client = ARTRealtime(options: AblyTests.commonAppSetup()) + defer { client.dispose(); client.close() } + let channel = client.channels.get("foo") + + waitUntil(timeout: testTimeout) { done in + channel.attach() { error in + expect(error).to(beNil()) + done() + } + } + + client.onSuspended() + expect(channel.state).to(equal(ARTRealtimeChannelState.Suspended)) + + waitUntil(timeout: testTimeout) { done in + channel.detach() { error in + expect(error).to(beNil()) + done() + } + } + + expect(channel.state).to(equal(ARTRealtimeChannelState.Detached)) + } + } // RTL6