Fix disabling of RCTDevMenu for tests on iOS 9.3

After upgrading to Xcode 7.3, the test bundle is being loaded before the rest of the app. We need to ensure +[RCTDevMenu load] is called before we remove it from the set of native modules.
This commit is contained in:
Scott Kyle 2016-03-22 09:54:06 -07:00
parent 0e74362e4c
commit 88f6191a61

View File

@ -34,18 +34,31 @@ extern NSMutableArray *RCTGetModuleClasses(void);
- (void)setUp;
@end
@interface RCTDevMenuDisabler : RCTDevMenu
@end
@interface RealmReactTests : RealmJSTests
@end
@interface RealmReactChromeTests : RealmReactTests
@end
@implementation RCTDevMenuDisabler
+ (void)load {
// +[RCTDevMenu load] is guaranteed to have been called since it's the superclass.
// We remove it since it interferes with us fully controlling the executor class.
NSMutableArray *moduleClasses = RCTGetModuleClasses();
[moduleClasses removeObject:[RCTDevMenu class]];
}
@end
@implementation RealmReactTests
+ (void)load {
NSMutableArray *moduleClasses = RCTGetModuleClasses();
[moduleClasses removeObject:[RCTDevMenu class]];
RCTAddLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) {
NSAssert(level < RCTLogLevelError, RCTFormatLog(nil, level, fileName, lineNumber, message));
});
@ -224,6 +237,7 @@ extern NSMutableArray *RCTGetModuleClasses(void);
@end
@implementation RealmReactChromeTests
+ (Class)executorClass {