         let purchaserInfoCachePrefix = "com.revenuecat.userdefaults.purchaserInfo"
 
         var appUserID: String?
+        var cachedUserInfoCount = 0
         var cachedUserInfo = [String : Data]()
 
         override func string(forKey defaultName: String) -> String? {

        override func set(_ value: Any?, forKey defaultName: String) {
            if (defaultName == appUserIDKey) {
                appUserID = value as! String?
            } else if (defaultName.starts(with: purchaserInfoCachePrefix)){
                cachedUserInfo[defaultName] = value as! Data?
            }
        }

        }
    }

    func testCachesPurchaserInfoOnPurchase() {
        setupPurchases()

        expect(self.purchasesDelegate.purchaserInfo).toEventuallyNot(beNil())

        expect(self.userDefaults.cachedUserInfo.count).to(equal(1))

        self.backend.postReceiptPurchaserInfo = RCPurchaserInfo(data: [
            "subscriber": [
                "subscriptions": [:],
                "other_purchases": [:]
            ]]);

        let product = MockProduct(mockProductIdentifier: "com.product.id1")
        self.purchases?.makePurchase(product)

        let transaction = MockTransaction()
        transaction.mockPayment = self.storeKitWrapper.payment!

        transaction.mockState = SKPaymentTransactionState.purchasing
        self.storeKitWrapper.delegate?.storeKitWrapper(self.storeKitWrapper, updatedTransaction: transaction)

        transaction.mockState = SKPaymentTransactionState.purchased
        self.storeKitWrapper.delegate?.storeKitWrapper(self.storeKitWrapper, updatedTransaction: transaction)

        expect(self.backend.postReceiptDataCalled).to(equal(true))

        expect(self.userDefaults.cachedUserInfoCount).toEventually(equal(2))
    }

    func testSendsCachesPurchaserInfoToDelegateIfExistsOnLaunch() {
        let info = RCPurchaserInfo(data: [
            "subscriber": [
