Skip to content

Commit

Permalink
Merge pull request #370 from ably/rsp4b3
Browse files Browse the repository at this point in the history
RSP4b3
  • Loading branch information
tcard committed Apr 1, 2016
2 parents e0a8edd + a5b2dcf commit c543e39
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions Spec/RestClientPresence.swift
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,51 @@ class RestClientPresence: QuickSpec {

}

// RSP4
context("history") {

// RSP4b
context("query argument") {

// RSP4b3
it("limit supports up to 1000 members") {
let options = AblyTests.commonAppSetup()
let client = ARTRest(options: options)
let channel = client.channels.get("test")

var realtime: ARTRealtime!
defer { realtime.close() }

waitUntil(timeout: testTimeout) { done in
realtime = AblyTests.addMembersSequentiallyToChannel("test", members: 1, options: options) {
done()
}.first
}

let query = ARTDataQuery()
expect(query.limit).to(equal(100))
query.limit = 1

waitUntil(timeout: testTimeout) { done in
try! channel.presence.history(query) { membersPage, error in
expect(error).to(beNil())
expect(membersPage!.items).to(haveCount(1))
expect(membersPage!.hasNext).to(beFalse())
expect(membersPage!.isLast).to(beTrue())
done()
}
}

query.limit = 1001

expect { try channel.presence.history(query) { _, _ in } }.to(throwError { (error: ErrorType) in
expect(error._code).to(equal(ARTDataQueryError.Limit.rawValue))
})
}
}

}

}
}
}
Expand Down

0 comments on commit c543e39

Please sign in to comment.