Last active
September 17, 2015 15:28
-
-
Save saiday/fe60b1518d33144f6bad 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 ViewControllerTests : XCTestCase | |
| @property (nonatomic) CustomViewController *viewController; | |
| @property (nonatomic) BOOL beenDealloc; | |
| @property (nonatomic) id<AspectToken> aspectToken; | |
| @end | |
| - (void)setUp { | |
| [super setUp]; | |
| self.viewController = [[CustomViewController alloc] init]; | |
| @weakify(self); | |
| self.aspectToken = [self.viewController aspect_hookSelector:NSSelectorFromString(@"dealloc") withOptions:AspectPositionBefore usingBlock:^(id<AspectInfo> aspectInfo) { | |
| @strongify(self); | |
| self.beenDealloc = YES; | |
| }error:nil]; | |
| } | |
| - (void)tearDown { | |
| self.viewController = 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