             let message2 = Message()
             message2.identifier = "msg2"
             message2.subscription = subscription2
+            message2.createdAt = Date()
 
             realm.add([subscription1, subscription2, message1, message2], update: true)
 

    }

    func testAllMessagesReturnsMessagesOrderedByDate() {
        Realm.executeOnMainThread({ realm in
            let subscription = Subscription()
            subscription.identifier = "subscription"


extension MessageManagerSpec {

    func testAllMessagesReturnsOnlyRelatedToSubscription() {
        Realm.execute({ realm in
            let subscription1 = Subscription()
            subscription1.identifier = "subs1"

            let message1 = Message()
            message1.identifier = "msg1"
            message1.subscription = subscription1
            message1.createdAt = Date()

            let subscription2 = Subscription()
            subscription2.identifier = "subs2"
