I'm testing a class that depends on an instance of UserDefaults. In following this sample code found here, I create and setup the instance like so:
override func setUp() {
super.setUp()
defaults = UserDefaults(suiteName: #file)
defaults.removePersistentDomain(forName: #file)
}
After running the tests, a plist file is created within the same directory as this test class. If my testing file is named TestFile.swift the plist is given the name TestFile.swift.plist. I'm pretty sure this is generated at the call of the suiteName: initializer above. My question is: how do I remove this file once the tests have completed? I've tried making calls to removeSuite(named: #file), removeVolatileDomain(forName: #file), and removePersistentDomain(forName: #file) within the test's tearDown method but no luck. Calling synchronize() didn't seem to help either.