Created
January 31, 2013 11:59
-
-
Save jmnavarro/4682392 to your computer and use it in GitHub Desktop.
Determine if host app is running in test environment or in real one. Usefull to use in applicationDidFinishLaunching to change the startup path.
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
// | |
// NSProcessInfo+DetectTestEnvironment.h | |
// Memoir | |
// | |
// Created by JM - http://jmnavarro.github.com | |
// | |
#import <Foundation/Foundation.h> | |
@interface NSProcessInfo (DetectTestEnvironment) | |
- (BOOL)isRunningTests; | |
@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
// | |
// NSProcessInfo+DetectTestEnvironment.m | |
// | |
// Created by JM - http://jmnavarro.github.com | |
// | |
#import "NSProcessInfo+DetectTestEnvironment.h" | |
@implementation NSProcessInfo (DetectTestEnvironment) | |
- (BOOL)isRunningTests { | |
for (NSString *arg in [[NSProcessInfo processInfo] arguments]) { | |
if ([[arg lowercaseString] isEqualToString:@"-sentest"] || [arg hasSuffix:@".octests"]) { | |
return YES; | |
} | |
} | |
return NO; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment