Created
May 11, 2013 06:14
-
-
Save adamyanalunas/5559070 to your computer and use it in GitHub Desktop.
Stubbing PSPDFViewController
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
context(@"stubbing init/alloc", ^{ | |
describe(@"can stub", ^{ | |
__block PSPDFViewController *psVC; | |
__block PSPDFViewController *initVC; | |
beforeEach(^{ | |
psVC = PSPDFViewController.alloc; | |
initVC = [psVC init]; | |
[PSPDFViewController stub:@selector(alloc) andReturn:psVC]; | |
[PSPDFViewController stub:@selector(init) andReturn:initVC]; | |
}); | |
it(@"has one kind of stub", ^{ | |
NSLog(@"VC: %@", psVC); | |
NSLog(@"init: %@", initVC); | |
PSPDFViewController *newVC = [PSPDFViewController.alloc init]; | |
NSLog(@"and new: %@", newVC); | |
PSPDFViewController *anotherVC = [PSPDFViewController.alloc init]; | |
NSLog(@"blah: %@", anotherVC); | |
}); | |
it(@"has a different instance because of beforeEach:", ^{ | |
NSLog(@"VC: %@", psVC); | |
NSLog(@"init: %@", initVC); | |
}); | |
}); | |
}); |
Author
adamyanalunas
commented
May 11, 2013
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment