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

RTL6g4 #409

Merged
merged 1 commit into from
Apr 28, 2016
Merged
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
40 changes: 40 additions & 0 deletions Spec/RealtimeClientChannel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1363,6 +1363,46 @@ class RealtimeClientChannel: QuickSpec {
}
}

// RTL6g4
it("message should be published following authentication and received back with the clientId intact") {
let options = AblyTests.clientOptions()
options.authCallback = { tokenParams, completion in
completion(getTestTokenDetails(clientId: "john"), nil)
}
let client = ARTRealtime(options: options)
defer { client.close() }
let channel = client.channels.get("test")
let message = ARTMessage(name: nil, data: "message", clientId: "john")
waitUntil(timeout: testTimeout) { done in
channel.subscribe() { received in
expect(received.clientId).to(equal(message.clientId))
done()
}
channel.publish([message]) { error in
expect(error).to(beNil())
}
}
}

// RTL6g4
it("message should be rejected by the Ably service and the message error should contain the server error") {
let options = AblyTests.clientOptions()
options.authCallback = { tokenParams, completion in
completion(getTestTokenDetails(clientId: "john"), nil)
}
let client = ARTRealtime(options: options)
defer { client.close() }
let channel = client.channels.get("test")
let message = ARTMessage(name: nil, data: "message", clientId: "tester")
waitUntil(timeout: testTimeout) { done in
channel.publish([message]) { error in
expect(error!.code).to(equal(40012))
expect(error!.message).to(contain("mismatched clientId"))
done()
}
}
}

}

// RTL6h
Expand Down