Skip to content
This repository has been archived by the owner on Feb 8, 2022. It is now read-only.

Commit

Permalink
Improving a test
Browse files Browse the repository at this point in the history
  • Loading branch information
Pol Quintana committed Feb 10, 2016
1 parent 757dc70 commit c92d20b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -487,15 +487,14 @@ class CacheSpec: QuickSpec {
var keyPath: String?
beforeEach {
initWithKeypath()
waitUntil(timeout: 2) { done in
waitUntil { done in
let queue = dispatch_queue_create("lock", DISPATCH_QUEUE_SERIAL)
dispatch_async(queue) {
let task = Task()
task.id = 1
keyPath = cache.keyPathForObject(task)
done()
}
while keyPath != nil {}
done()
}
}
it("executes in main thread at the end and works") {
Expand Down
2 changes: 1 addition & 1 deletion Source/RealmResultsCache.swift
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ class RealmResultsCache<T: Object> {
func keyPathForObject(object: T) -> String {
var keyPathValue = defaultKeyPathValue
if let keyPath = sectionKeyPath {
if keyPath.isEmpty { return defaultKeyPathValue }
if keyPath.isEmpty { return defaultKeyPathValue }
Threading.executeOnMainThread(true) {
if let objectKeyPathValue = object.valueForKeyPath(keyPath) {
keyPathValue = String(objectKeyPathValue)
Expand Down

0 comments on commit c92d20b

Please sign in to comment.