mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-01-12 22:51:50 +08:00
Cleanup test environment header
This commit is contained in:
@@ -29,17 +29,8 @@
|
||||
#import <RestKit/Testing.h>
|
||||
#import <RestKit/RKManagedObjectStore.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// OCMock - For some reason this macro is incorrect. Note the use of __typeof
|
||||
|
||||
#undef OCMOCK_VALUE
|
||||
#define OCMOCK_VALUE(variable) [NSValue value:&variable withObjCType:@encode(__typeof(variable))]
|
||||
|
||||
RKOAuthClient* RKTestNewOAuthClient(RKTestResponseLoader* loader);
|
||||
|
||||
// TODO: Figure out how to extract...
|
||||
void RKTestClearCacheDirectory(void);
|
||||
|
||||
/*
|
||||
Base class for RestKit test cases. Provides initialization of testing
|
||||
infrastructure.
|
||||
|
||||
@@ -22,18 +22,15 @@
|
||||
#import "RKTestEnvironment.h"
|
||||
#import "RKParserRegistry.h"
|
||||
|
||||
RKOAuthClient* RKTestNewOAuthClient(RKTestResponseLoader* loader){
|
||||
RKOAuthClient* RKTestNewOAuthClient(RKTestResponseLoader* loader)
|
||||
{
|
||||
[loader setTimeout:10];
|
||||
RKOAuthClient* client = [RKOAuthClient clientWithClientID:@"appID" secret:@"appSecret"];
|
||||
RKOAuthClient *client = [RKOAuthClient clientWithClientID:@"appID" secret:@"appSecret"];
|
||||
client.delegate = loader;
|
||||
client.authorizationURL = [NSString stringWithFormat:@"%@/oauth/authorize", [RKTestFactory baseURLString]];
|
||||
return client;
|
||||
}
|
||||
|
||||
void RKTestClearCacheDirectory(void) {
|
||||
|
||||
}
|
||||
|
||||
@implementation RKTestCase
|
||||
|
||||
+ (void)initialize
|
||||
@@ -62,15 +59,18 @@ void RKTestClearCacheDirectory(void) {
|
||||
@end
|
||||
|
||||
@implementation SenTestCase (MethodSwizzling)
|
||||
|
||||
- (void)swizzleMethod:(SEL)aOriginalMethod
|
||||
inClass:(Class)aOriginalClass
|
||||
withMethod:(SEL)aNewMethod
|
||||
fromClass:(Class)aNewClass
|
||||
executeBlock:(void (^)(void))aBlock {
|
||||
executeBlock:(void (^)(void))aBlock
|
||||
{
|
||||
Method originalMethod = class_getClassMethod(aOriginalClass, aOriginalMethod);
|
||||
Method mockMethod = class_getInstanceMethod(aNewClass, aNewMethod);
|
||||
method_exchangeImplementations(originalMethod, mockMethod);
|
||||
aBlock();
|
||||
method_exchangeImplementations(mockMethod, originalMethod);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user