         override func string(forKey defaultName: String) -> String? {
             return appUserID
         }
+
+        override func set(_ value: Any?, forKey defaultName: String) {
+            appUserID = value as! String?
+        }
     }
 
     class PurchasesDelegate: RCPurchasesDelegate {

        expect(purchaserInfo).toEventuallyNot(beNil());
    }

    func testAnonPurchasesGeneratesAnAppID() {
        setupAnonPurchases()
    }
}

    var purchases: RCPurchases?

    func setupPurchases() {
        purchases = RCPurchases(appUserID: appUserID,
                                requestFetcher: requestFetcher,
                                backend:backend,
                                storeKitWrapper: storeKitWrapper,
                                notificationCenter:notificationCenter,
                                userDefaults:userDefaults)

        purchases!.delegate = purchasesDelegate
    }

    func setupAnonPurchases() {
        purchases = RCPurchases(appUserID: nil,
                                requestFetcher: requestFetcher,
                                backend:backend,
                                storeKitWrapper: storeKitWrapper,
                                notificationCenter:notificationCenter,
                                userDefaults:userDefaults)

        purchases!.delegate = purchasesDelegate
    }
