Skip to content

Commit

Permalink
RTL6g4 (#409)
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardopereira authored and tcard committed Apr 28, 2016
1 parent e8ec408 commit 0f5549a
Showing 1 changed file with 40 additions and 0 deletions.
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

0 comments on commit 0f5549a

Please sign in to comment.