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

RTP9a #332

Merged
merged 1 commit into from
Apr 1, 2016
Merged

RTP9a #332

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
RTP9a
  • Loading branch information
ricardopereira committed Mar 21, 2016
commit be2f818d0297e454b0011da3913455aa94d1b30b
55 changes: 55 additions & 0 deletions Spec/RealtimeClientPresence.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,61 @@ class RealtimeClientPresence: QuickSpec {
}
}

// RTP9
context("update") {

// RTP9a
it("should update the data for the present member with a value") {
let options = AblyTests.commonAppSetup()
options.clientId = "john"
let client = ARTRealtime(options: options)
defer { client.close() }
let channel = client.channels.get("test")

waitUntil(timeout: testTimeout) { done in
channel.presence.subscribe(.Enter) { member in
expect(member.data).to(beNil())
done()
}
channel.presence.enter(nil)
}

waitUntil(timeout: testTimeout) { done in
channel.presence.subscribe(.Update) { member in
expect(member.data as? NSObject).to(equal("online"))
done()
}
channel.presence.update("online")
}
}

// RTP9a
it("should update the data for the present member with null") {
let options = AblyTests.commonAppSetup()
options.clientId = "john"
let client = ARTRealtime(options: options)
defer { client.close() }
let channel = client.channels.get("test")

waitUntil(timeout: testTimeout) { done in
channel.presence.subscribe(.Enter) { member in
expect(member.data as? NSObject).to(equal("online"))
done()
}
channel.presence.enter("online")
}

waitUntil(timeout: testTimeout) { done in
channel.presence.subscribe(.Update) { member in
expect(member.data).to(beNil())
done()
}
channel.presence.update(nil)
}
}

}

// RTP15e
let cases: [String:(ARTRealtimePresence, Optional<(ARTErrorInfo?)->Void>)->()] = [
"enterClient": { $0.enterClient("john", data: nil, callback: $1) },
Expand Down