Last active
September 17, 2015 15:28
-
-
Save saiday/c2cbd112c7f0b646f6de to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @interface KVOObjectTests : XCTestCase | |
| @property (nonatomic) KVOObject *kVOObject; | |
| @property (nonatomic) BOOL beenDealloc; | |
| @property (nonatomic) id<AspectToken> aspectToken; | |
| @end | |
| - (void)setUp { | |
| [super setUp]; | |
| self.kVOObject = [[KVOObject alloc] init]; | |
| @weakify(self); | |
| self.aspectToken = [KVOObject | |
| aspect_hookSelector:NSSelectorFromString(@"dealloc") | |
| withOptions:AspectPositionBefore usingBlock:^(id<AspectInfo> aspectInfo){ | |
| @strongify(self); | |
| self.beenDealloc = YES; | |
| } error: nil]; | |
| } | |
| - (void)tearDown { | |
| self.kVOObject = nil; | |
| assertThatBool(self.beenDealloc, isTrue()); | |
| [self.aspectToken remove]; | |
| [super tearDown]; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment