Cleanup test environment header

This commit is contained in:
Blake Watters
2012-04-09 13:44:30 -04:00
parent af7ecee223
commit 95decfaa09
2 changed files with 7 additions and 16 deletions

View File

@@ -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.

View File

@@ -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