Last active
August 29, 2015 13:57
-
-
Save klaaspieter/9401456 to your computer and use it in GitHub Desktop.
This file contains 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 ViewController : UIViewController | |
@property (nonatomatic, readwrite, strong) APIClient *apiClient; | |
@end | |
@implementation ViewController | |
- (APIClient *)apiClient; | |
{ | |
if (!_apiClient) { | |
_apiClient = [[APIClient alloc] initWithBaseURL:someConfig.baseURL]; | |
} | |
return _apiClient; | |
} | |
@end |
This file contains 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
#import "SpecHelper.h" | |
describe(@"ViewController", ^{ | |
__block ViewController *_viewController; | |
before(^{ | |
_viewController = [[UIStoryboard mainStoryboard] instantiateViewControllerForClass:[ViewController class]]; | |
}); | |
it(@"has a default api client", ^{ | |
expect(_viewController.apiClient).toNot.beNil(); | |
}); | |
it(@"can set a different api client", ^{ | |
APIClient *client = mock([APIClient class]); | |
_viewController.apiClient = client; | |
expect(_viewController.apiClient).to.equal(client); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment