Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RTL8 #219

Merged
merged 2 commits into from
Feb 18, 2016
Merged

RTL8 #219

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions ablySpec/RealtimeClientChannel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -828,6 +828,55 @@ class RealtimeClientChannel: QuickSpec {

}

// RTL8
context("unsubscribe") {

// RTL8a
it("with no arguments unsubscribes the provided listener to all messages if subscribed") {
let client = ARTRealtime(options: AblyTests.commonAppSetup())
defer { client.close() }

let channel = client.channels.get("test")

waitUntil(timeout: testTimeout) { done in
let listener = channel.subscribe { message in
fail("Listener shouldn't exist")
done()
}

channel.unsubscribe(listener)

channel.publish(nil, data: "message") { errorInfo in
expect(errorInfo).to(beNil())
done()
}
}
}

// RTL8b
it("with a single name argument unsubscribes the provided listener if previously subscribed with a name-specific subscription") {
let client = ARTRealtime(options: AblyTests.commonAppSetup())
defer { client.close() }

let channel = client.channels.get("test")

waitUntil(timeout: testTimeout) { done in
let eventAListener = channel.subscribe("eventA") { message in
fail("Listener shouldn't exist")
done()
}

channel.unsubscribe("eventA", listener: eventAListener)

channel.publish("eventA", data: "message") { errorInfo in
expect(errorInfo).to(beNil())
done()
}
}
}

}

// RTL10
context("history") {

Expand Down