Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Ported RestKit tests over to using the RKTestFactory and completed do…

…cumentation. fixes #318
  • Loading branch information...
commit 868372272fece3b6e6f97abdcd28e17dabf5d852 1 parent a84f523
@blakewatters blakewatters authored
Showing with 325 additions and 368 deletions.
  1. +2 −2 Code/Support/RKFixCategoryBug.h
  2. +52 −47 Code/Testing/RKTestFactory.h
  3. +73 −48 Code/Testing/RKTestFactory.m
  4. BIN  Resources/RestKitCoreData.xcdatamodeld/RestKitCoreData.xcdatamodel/elements
  5. BIN  Resources/RestKitCoreData.xcdatamodeld/RestKitCoreData.xcdatamodel/layout
  6. +11 −11 Tests/Logic/CoreData/RKInMemoryEntityCacheTest.m
  7. +6 −7 Tests/Logic/CoreData/RKManagedObjectLoaderTest.m
  8. +12 −12 Tests/Logic/CoreData/RKManagedObjectMappingOperationTest.m
  9. +11 −11 Tests/Logic/CoreData/RKManagedObjectMappingTest.m
  10. +1 −1  Tests/Logic/CoreData/RKManagedObjectStoreTest.m
  11. +11 −11 Tests/Logic/CoreData/RKManagedObjectThreadSafeInvocationTest.m
  12. +2 −2 Tests/Logic/CoreData/RKSearchWordObserverTest.m
  13. +1 −1  Tests/Logic/CoreData/RKSearchableManagedObjectTest.m
  14. +4 −4 Tests/Logic/Network/RKAuthenticationTest.m
  15. +2 −4 Tests/Logic/Network/RKClientTest.m
  16. +4 −4 Tests/Logic/Network/RKParamsTest.m
  17. +6 −6 Tests/Logic/Network/RKRequestQueueTest.m
  18. +55 −55 Tests/Logic/Network/RKRequestTest.m
  19. +1 −1  Tests/Logic/Network/RKResponseTest.m
  20. +2 −2 Tests/Logic/Network/RKURLTest.m
  21. +33 −33 Tests/Logic/ObjectMapping/RKObjectLoaderTest.m
  22. +10 −10 Tests/Logic/ObjectMapping/RKObjectManagerTest.m
  23. +2 −2 Tests/Logic/ObjectMapping/RKObjectMappingNextGenTest.m
  24. +4 −4 Tests/Logic/ObjectMapping/RKObjectMappingProviderTest.m
  25. +16 −16 Tests/Logic/ObjectMapping/RKObjectPaginatorTest.m
  26. +2 −9 Tests/RKTestEnvironment.h
  27. +2 −65 Tests/RKTestEnvironment.m
View
4 Code/Support/RKFixCategoryBug.h
@@ -3,7 +3,7 @@
// RestKit
//
// Created by Blake Watters on 9/1/11.
-// Copyright 2011 Two Toasters
+// Copyright 2011 RestKit
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -21,7 +21,7 @@
#ifndef RestKit_RKCategoryFix_h
#define RestKit_RKCategoryFix_h
-/**
+/*
Add this macro before each category implementation, so we don't have to use
-all_load or -force_load to load object files from static libraries that only contain
categories and no classes.
View
99 Code/Testing/RKTestFactory.h
@@ -27,27 +27,31 @@
Called once per unit testing run when the sharedFactory instance is initialized. RestKit
applications can override via a category.
*/
-- (void)didInitialize;
++ (void)didInitialize;
/**
Application specific customization point for the sharedFactory.
Invoked each time the factory is asked to set up the environment. RestKit applications
leveraging the factory may override via a category.
*/
-- (void)didSetUp;
++ (void)didSetUp;
/**
Application specific customization point for the sharedFactory.
Invoked each time the factory is tearing down the environment. RestKit applications
leveraging the factory may override via a category.
*/
-- (void)didTearDown;
++ (void)didTearDown;
@end
/**
RKTestFactory provides an interface for initializing RestKit
- objects within a unit testing environment.
+ objects within a unit testing environment. The factory is used to ensure isolation
+ between test cases by ensuring that RestKit's important singleton objects are torn
+ down between tests and that each test is working within a clean Core Data environment.
+ Callback hooks are provided so that application specific set up and tear down logic can be
+ integrated as well.
*/
@interface RKTestFactory : NSObject <RKTestFactoryCallbacks>
@@ -56,90 +60,91 @@
///-----------------------------------------------------------------------------
/**
- The baseURL with which to initialize RKClient and RKObjectManager
+ Returns the base URL with which to initialize RKClient and RKObjectManager
instances created via the factory.
+
+ @return The base URL for the factory.
*/
-@property (nonatomic, strong) RKURL *baseURL;
++ (RKURL *)baseURL;
/**
- The class to use when instantiating new client instances.
+ Sets the base URL for the factory.
- **Default**: [RKClient class]
+ @param URL The new base URL.
*/
-@property (nonatomic, strong) Class clientClass;
++ (void)setBaseURL:(RKURL *)URL;
/**
- The class to use when instantiating new object manager instances.
+ Returns the base URL as a string value.
- **Default**: [RKObjectManager class]
+ @return The base URL for the factory, as a string.
*/
-@property (nonatomic, strong) Class objectManagerClass;
-
-///-----------------------------------------------------------------------------
-/// @name Accessing the Shared Factory Instance
-///-----------------------------------------------------------------------------
++ (NSString *)baseURLString;
/**
- Returns the shared test factory object.
+ Sets the base URL for the factory to a new value by constructing an RKURL
+ from the given string.
- @return The shared test factory.
+ @param A string containing the URL to set as the base URL for the factory.
*/
-+ (RKTestFactory *)sharedFactory;
++ (void)setBaseURLString:(NSString *)baseURLString;
///-----------------------------------------------------------------------------
/// @name Building Instances
///-----------------------------------------------------------------------------
/**
- Create and return an RKClient instance.
+ Creates and returns an RKClient instance.
+
+ @return A new client object.
*/
-- (RKClient *)client;
++ (RKClient *)client;
/**
- Create and return an RKObjectManager instance.
+ Creates and returns an RKObjectManager instance.
+
+ @return A new client object.
*/
-- (RKObjectManager *)objectManager;
++ (RKObjectManager *)objectManager;
/**
- Create and return an RKManagedObjectStore instance.
+ Creates and returns a RKManagedObjectStore instance.
+
+ A new managed object store will be configured and returned. If there is an existing
+ persistent store (i.e. from a previous test invocation), then the persistent store
+ is deleted.
+
+ @return A new managed object store object.
*/
-- (RKManagedObjectStore *)objectStore;
++ (RKManagedObjectStore *)managedObjectStore;
+
+///-----------------------------------------------------------------------------
+/// @name Managing Test State
+///-----------------------------------------------------------------------------
/**
Sets up the RestKit testing environment. Invokes the didSetUp callback for application
specific setup.
*/
-- (void)setUp;
++ (void)setUp;
/**
Tears down the RestKit testing environment by clearing singleton instances, helping to
ensure test case isolation. Invokes the didTearDown callback for application specific
cleanup.
*/
-- (void)tearDown;
-
-@end
++ (void)tearDown;
-/**
- The ConvenienceAliases category provides a static interface for performing
- common tasks on the RKTestFactory sharedInstance. All methods defined within the category
- are static aliases for instance method counterparts on [RKTestFactory sharedFactory].
- */
-@interface RKTestFactory (ConvenienceAliases)
+///-----------------------------------------------------------------------------
+/// @name Other Tasks
+///-----------------------------------------------------------------------------
/**
- Ensures the test factory has been initialized
+ Clears the contents of the cache directory by removing the directory and
+ recreating it.
+
+ @see [RKDirectory cachesDirectory]
*/
-+ (void)setUp;
-+ (void)tearDown;
-
-+ (RKURL *)baseURL;
-+ (void)setBaseURL:(RKURL *)URL;
-+ (NSString *)baseURLString;
-+ (void)setBaseURLString:(NSString *)baseURLString;
-
-+ (RKClient *)client;
-+ (RKObjectManager *)objectManager;
-+ (RKManagedObjectStore *)objectStore;
++ (void)clearCacheDirectory;
@end
View
121 Code/Testing/RKTestFactory.m
@@ -8,6 +8,16 @@
#import "RKTestFactory.h"
+@interface RKTestFactory ()
+
+@property (nonatomic, strong) RKURL *baseURL;
+@property (nonatomic, strong) Class clientClass;
+@property (nonatomic, strong) Class objectManagerClass;
+
++ (RKTestFactory *)sharedFactory;
+
+@end
+
static RKTestFactory *sharedFactory = nil;
@implementation RKTestFactory
@@ -16,7 +26,8 @@ @implementation RKTestFactory
@synthesize clientClass;
@synthesize objectManagerClass;
-+ (RKTestFactory *)sharedFactory {
++ (RKTestFactory *)sharedFactory
+{
if (! sharedFactory) {
sharedFactory = [RKTestFactory new];
}
@@ -24,22 +35,24 @@ + (RKTestFactory *)sharedFactory {
return sharedFactory;
}
-- (id)init {
+- (id)init
+{
self = [super init];
if (self) {
- self.baseURL = [RKURL URLWithString:@"http://localhost:4567"];
+ self.baseURL = [RKURL URLWithString:@"http://127.0.0.1:4567"];
self.clientClass = [RKClient class];
self.objectManagerClass = [RKObjectManager class];
- if ([self respondsToSelector:@selector(didInitialize)]) {
- [self didInitialize];
+ if ([RKTestFactory respondsToSelector:@selector(didInitialize)]) {
+ [RKTestFactory didInitialize];
}
}
return self;
}
-- (RKClient *)client {
+- (RKClient *)client
+{
RKClient *client = [self.clientClass clientWithBaseURL:self.baseURL];
[RKClient setSharedClient:client];
client.requestQueue.suspended = NO;
@@ -47,7 +60,8 @@ - (RKClient *)client {
return client;
}
-- (RKObjectManager *)objectManager {
+- (RKObjectManager *)objectManager
+{
[RKObjectManager setDefaultMappingQueue:dispatch_queue_create("org.restkit.ObjectMapping", DISPATCH_QUEUE_SERIAL)];
[RKObjectMapping setDefaultDateFormatters:nil];
RKObjectManager *objectManager = [self.objectManagerClass managerWithBaseURL:self.baseURL];
@@ -60,68 +74,79 @@ - (RKObjectManager *)objectManager {
return objectManager;
}
-- (RKManagedObjectStore *)objectStore {
- RKManagedObjectStore *store = [RKManagedObjectStore objectStoreWithStoreFilename:@"RKTests.sqlite"];
- [store deletePersistantStore];
- [RKManagedObjectStore setDefaultObjectStore:store];
-
- return store;
-}
-
-- (void)setUp {
- if ([self respondsToSelector:@selector(didSetUp)]) {
- [self didSetUp];
- }
-}
-
-- (void)tearDown {
- [RKObjectManager setSharedManager:nil];
- [RKClient setSharedClient:nil];
- [RKManagedObjectStore setDefaultObjectStore:nil];
-
- if ([self respondsToSelector:@selector(didTearDown)]) {
- [self didTearDown];
- }
-}
+#pragma mark - Public Static Interface
-@end
-
-@implementation RKTestFactory (ConvenienceAliases)
-
-+ (void)setUp {
- [[RKTestFactory sharedFactory] setUp];
-}
-
-+ (RKURL *)baseURL {
++ (RKURL *)baseURL
+{
return [RKTestFactory sharedFactory].baseURL;
}
-+ (void)setBaseURL:(RKURL *)URL {
++ (void)setBaseURL:(RKURL *)URL
+{
[RKTestFactory sharedFactory].baseURL = URL;
}
-+ (NSString *)baseURLString {
++ (NSString *)baseURLString
+{
return [[[RKTestFactory sharedFactory] baseURL] absoluteString];
}
-+ (void)setBaseURLString:(NSString *)baseURLString {
++ (void)setBaseURLString:(NSString *)baseURLString
+{
[[RKTestFactory sharedFactory] setBaseURL:[RKURL URLWithString:baseURLString]];
}
-+ (id)client {
++ (id)client
+{
return [[RKTestFactory sharedFactory] client];
}
-+ (id)objectManager {
++ (id)objectManager
+{
return [[RKTestFactory sharedFactory] objectManager];
}
-+ (id)objectStore {
- return [[RKTestFactory sharedFactory] objectStore];
++ (id)managedObjectStore
+{
+ RKManagedObjectStore *store = [RKManagedObjectStore objectStoreWithStoreFilename:@"RKTests.sqlite"];
+ [store deletePersistantStore];
+ [RKManagedObjectStore setDefaultObjectStore:store];
+
+ return store;
}
-+ (void)tearDown {
- [[RKTestFactory sharedFactory] tearDown];
++ (void)setUp
+{
+ if ([self respondsToSelector:@selector(didSetUp)]) {
+ [self didSetUp];
+ }
+}
+
++ (void)tearDown
+{
+ [RKObjectManager setSharedManager:nil];
+ [RKClient setSharedClient:nil];
+ [RKManagedObjectStore setDefaultObjectStore:nil];
+
+ if ([self respondsToSelector:@selector(didTearDown)]) {
+ [self didTearDown];
+ }
+}
+
++ (void)clearCacheDirectory
+{
+ NSError* error = nil;
+ NSString* cachePath = [RKDirectory cachesDirectory];
+ BOOL success = [[NSFileManager defaultManager] removeItemAtPath:cachePath error:&error];
+ if (success) {
+ RKLogInfo(@"Cleared cache directory...");
+ success = [[NSFileManager defaultManager] createDirectoryAtPath:cachePath withIntermediateDirectories:YES attributes:nil error:&error];
+ if (!success) {
+ RKLogError(@"Failed creation of cache path '%@': %@", cachePath, [error localizedDescription]);
+ }
+ } else {
+ RKLogError(@"Failed to clear cache path '%@': %@", cachePath, [error localizedDescription]);
+ }
}
@end
View
BIN  Resources/RestKitCoreData.xcdatamodeld/RestKitCoreData.xcdatamodel/elements
Binary file not shown
View
BIN  Resources/RestKitCoreData.xcdatamodeld/RestKitCoreData.xcdatamodel/layout
Binary file not shown
View
22 Tests/Logic/CoreData/RKInMemoryEntityCacheTest.m
@@ -28,7 +28,7 @@ @interface RKInMemoryEntityCacheTest : RKTestCase
@implementation RKInMemoryEntityCacheTest
- (void)testShouldCoercePrimaryKeysToStringsForLookup {
- RKManagedObjectStore* objectStore = [RKTestFactory objectStore];
+ RKManagedObjectStore* objectStore = [RKTestFactory managedObjectStore];
RKHuman* human = [RKHuman createEntity];
human.railsID = [NSNumber numberWithInt:1234];
[objectStore save:nil];
@@ -38,7 +38,7 @@ - (void)testShouldCoercePrimaryKeysToStringsForLookup {
}
- (void)testShouldCacheAllObjectsForEntityWhenAccessingEntityCache {
- RKManagedObjectStore* objectStore = [RKTestFactory objectStore];
+ RKManagedObjectStore* objectStore = [RKTestFactory managedObjectStore];
RKHuman* human = [RKHuman createEntity];
human.railsID = [NSNumber numberWithInt:1234];
[objectStore save:nil];
@@ -54,7 +54,7 @@ - (void)testShouldCacheAllObjectsForEntityWhenAccessingEntityCache {
}
- (void)testShouldCacheAllObjectsForEntityWhenAsked {
- RKManagedObjectStore* objectStore = [RKTestFactory objectStore];
+ RKManagedObjectStore* objectStore = [RKTestFactory managedObjectStore];
RKHuman* human = [RKHuman createEntity];
human.railsID = [NSNumber numberWithInt:1234];
[objectStore save:nil];
@@ -71,7 +71,7 @@ - (void)testShouldCacheAllObjectsForEntityWhenAsked {
}
- (void)testShouldRetrieveObjectsProperlyFromTheEntityCache {
- RKManagedObjectStore* objectStore = [RKTestFactory objectStore];
+ RKManagedObjectStore* objectStore = [RKTestFactory managedObjectStore];
RKHuman* human = [RKHuman createEntity];
human.railsID = [NSNumber numberWithInt:1234];
[objectStore save:nil];
@@ -87,7 +87,7 @@ - (void)testShouldRetrieveObjectsProperlyFromTheEntityCache {
}
- (void)testShouldCacheAnIndividualObjectWhenAsked {
- RKManagedObjectStore* objectStore = [RKTestFactory objectStore];
+ RKManagedObjectStore* objectStore = [RKTestFactory managedObjectStore];
RKHuman* human = [RKHuman createEntity];
human.railsID = [NSNumber numberWithInt:1234];
[objectStore save:nil];
@@ -113,7 +113,7 @@ - (void)testShouldCacheAnIndividualObjectWhenAsked {
}
- (void)testShouldCacheAnIndividualObjectByPrimaryKeyValueWhenAsked {
- RKManagedObjectStore* objectStore = [RKTestFactory objectStore];
+ RKManagedObjectStore* objectStore = [RKTestFactory managedObjectStore];
RKHuman* human = [RKHuman createEntity];
human.railsID = [NSNumber numberWithInt:1234];
[objectStore save:nil];
@@ -143,7 +143,7 @@ - (void)testShouldCacheAnIndividualObjectByPrimaryKeyValueWhenAsked {
}
- (void)testShouldExpireACacheEntryForAnObjectWhenAsked {
- RKManagedObjectStore* objectStore = [RKTestFactory objectStore];
+ RKManagedObjectStore* objectStore = [RKTestFactory managedObjectStore];
RKHuman* human = [RKHuman createEntity];
human.railsID = [NSNumber numberWithInt:1234];
[objectStore save:nil];
@@ -162,7 +162,7 @@ - (void)testShouldExpireACacheEntryForAnObjectWhenAsked {
}
- (void)testShouldExpireEntityCacheWhenAsked {
- RKManagedObjectStore* objectStore = [RKTestFactory objectStore];
+ RKManagedObjectStore* objectStore = [RKTestFactory managedObjectStore];
RKHuman* human = [RKHuman createEntity];
human.railsID = [NSNumber numberWithInt:1234];
[objectStore save:nil];
@@ -182,7 +182,7 @@ - (void)testShouldExpireEntityCacheWhenAsked {
#if TARGET_OS_IPHONE
- (void)testShouldExpireEntityCacheInResponseToMemoryWarning {
- RKManagedObjectStore* objectStore = [RKTestFactory objectStore];
+ RKManagedObjectStore* objectStore = [RKTestFactory managedObjectStore];
RKHuman* human = [RKHuman createEntity];
human.railsID = [NSNumber numberWithInt:1234];
[objectStore save:nil];
@@ -202,7 +202,7 @@ - (void)testShouldExpireEntityCacheInResponseToMemoryWarning {
#endif
- (void)testShouldAddInstancesOfInsertedObjectsToCache {
- RKManagedObjectStore* objectStore = [RKTestFactory objectStore];
+ RKManagedObjectStore* objectStore = [RKTestFactory managedObjectStore];
RKHuman* human = [RKHuman createEntity];
human.railsID = [NSNumber numberWithInt:1234];
[objectStore save:nil];
@@ -227,7 +227,7 @@ - (void)testShouldAddInstancesOfInsertedObjectsToCache {
}
- (void)testShouldRemoveInstancesOfDeletedObjectsToCache {
- RKManagedObjectStore* objectStore = [RKTestFactory objectStore];
+ RKManagedObjectStore* objectStore = [RKTestFactory managedObjectStore];
RKHuman* humanOne = [RKHuman createEntity];
humanOne.railsID = [NSNumber numberWithInt:1234];
View
13 Tests/Logic/CoreData/RKManagedObjectLoaderTest.m
@@ -26,7 +26,6 @@
#import "NSManagedObject+ActiveRecord.h"
#import "RKObjectMappingProvider+CoreData.h"
-
@interface RKManagedObjectLoaderTest : RKTestCase {
}
@@ -36,7 +35,7 @@ @interface RKManagedObjectLoaderTest : RKTestCase {
@implementation RKManagedObjectLoaderTest
- (void)testShouldDeleteObjectFromLocalStoreOnDELETE {
- RKManagedObjectStore* store = [RKTestFactory objectStore];
+ RKManagedObjectStore* store = [RKTestFactory managedObjectStore];
[store save:nil];
RKObjectManager* objectManager = [RKTestFactory objectManager];
objectManager.objectStore = store;
@@ -61,7 +60,7 @@ - (void)testShouldDeleteObjectFromLocalStoreOnDELETE {
}
- (void)testShouldLoadAnObjectWithAToOneRelationship {
- RKManagedObjectStore* store = [RKTestFactory objectStore];
+ RKManagedObjectStore* store = [RKTestFactory managedObjectStore];
RKObjectManager* objectManager = [RKTestFactory objectManager];
objectManager.objectStore = store;
@@ -84,7 +83,7 @@ - (void)testShouldLoadAnObjectWithAToOneRelationship {
}
- (void)testShouldDeleteObjectsMissingFromPayloadReturnedByObjectCache {
- RKManagedObjectStore* store = [RKTestFactory objectStore];
+ RKManagedObjectStore* store = [RKTestFactory managedObjectStore];
RKManagedObjectMapping* humanMapping = [RKManagedObjectMapping mappingForEntityWithName:@"RKHuman"
inManagedObjectStore:store];
[humanMapping mapKeyPath:@"id" toAttribute:@"railsID"];
@@ -127,7 +126,7 @@ - (void)testShouldDeleteObjectsMissingFromPayloadReturnedByObjectCache {
}
- (void)testShouldNotAssertDuringObjectMappingOnSynchronousRequest {
- RKManagedObjectStore* store = [RKTestFactory objectStore];
+ RKManagedObjectStore* store = [RKTestFactory managedObjectStore];
RKObjectManager* objectManager = [RKTestFactory objectManager];
objectManager.objectStore = store;
@@ -142,10 +141,10 @@ - (void)testShouldNotAssertDuringObjectMappingOnSynchronousRequest {
}
- (void)testShouldSkipObjectMappingOnRequestCacheHitWhenObjectCachePresent {
- RKTestClearCacheDirectory();
+ [RKTestFactory clearCacheDirectory];
RKObjectManager* objectManager = [RKTestFactory objectManager];
- RKManagedObjectStore* objectStore = [RKTestFactory objectStore];
+ RKManagedObjectStore* objectStore = [RKTestFactory managedObjectStore];
objectManager.objectStore = objectStore;
RKManagedObjectMapping* humanMapping = [RKManagedObjectMapping mappingForEntityWithName:@"RKHuman" inManagedObjectStore:objectStore];
[humanMapping mapKeyPath:@"id" toAttribute:@"railsID"];
View
24 Tests/Logic/CoreData/RKManagedObjectMappingOperationTest.m
@@ -35,7 +35,7 @@ @interface RKManagedObjectMappingOperationTest : RKTestCase {
@implementation RKManagedObjectMappingOperationTest
- (void)testShouldOverloadInitializationOfRKObjectMappingOperationToReturnInstancesOfRKManagedObjectMappingOperationWhenAppropriate {
- RKManagedObjectStore *store = [RKTestFactory objectStore];
+ RKManagedObjectStore *store = [RKTestFactory managedObjectStore];
RKManagedObjectMapping* managedMapping = [RKManagedObjectMapping mappingForClass:[RKHuman class] inManagedObjectStore:store];
NSDictionary* sourceObject = [NSDictionary dictionary];
RKHuman* human = [RKHuman createEntity];
@@ -52,7 +52,7 @@ - (void)testShouldOverloadInitializationOfRKObjectMappingOperationButReturnUnman
}
- (void)testShouldConnectRelationshipsByPrimaryKey {
- RKManagedObjectStore* objectStore = [RKTestFactory objectStore];
+ RKManagedObjectStore* objectStore = [RKTestFactory managedObjectStore];
RKManagedObjectMapping* catMapping = [RKManagedObjectMapping mappingForClass:[RKCat class] inManagedObjectStore:objectStore];
catMapping.primaryKeyAttribute = @"railsID";
@@ -81,7 +81,7 @@ - (void)testShouldConnectRelationshipsByPrimaryKey {
}
- (void)testConnectRelationshipsDoesNotLeakMemory {
- RKManagedObjectStore* objectStore = [RKTestFactory objectStore];
+ RKManagedObjectStore* objectStore = [RKTestFactory managedObjectStore];
RKManagedObjectMapping* catMapping = [RKManagedObjectMapping mappingForClass:[RKCat class] inManagedObjectStore:objectStore];
catMapping.primaryKeyAttribute = @"railsID";
@@ -110,7 +110,7 @@ - (void)testConnectRelationshipsDoesNotLeakMemory {
}
- (void)testConnectionOfHasManyRelationshipsByPrimaryKey {
- RKManagedObjectStore* objectStore = [RKTestFactory objectStore];
+ RKManagedObjectStore* objectStore = [RKTestFactory managedObjectStore];
RKManagedObjectMapping* catMapping = [RKManagedObjectMapping mappingForClass:[RKCat class] inManagedObjectStore:objectStore];
catMapping.primaryKeyAttribute = @"railsID";
@@ -139,7 +139,7 @@ - (void)testConnectionOfHasManyRelationshipsByPrimaryKey {
}
- (void)testShouldConnectRelationshipsByPrimaryKeyWithDifferentSourceAndDestinationKeyPaths {
- RKManagedObjectStore* objectStore = [RKTestFactory objectStore];
+ RKManagedObjectStore* objectStore = [RKTestFactory managedObjectStore];
RKManagedObjectMapping* catMapping = [RKManagedObjectMapping mappingForClass:[RKCat class] inManagedObjectStore:objectStore];
catMapping.primaryKeyAttribute = @"railsID";
@@ -175,7 +175,7 @@ - (void)testShouldConnectRelationshipsByPrimaryKeyWithDifferentSourceAndDestinat
}
- (void)testShouldLoadNestedHasManyRelationship {
- RKManagedObjectStore* objectStore = [RKTestFactory objectStore];
+ RKManagedObjectStore* objectStore = [RKTestFactory managedObjectStore];
RKManagedObjectMapping* catMapping = [RKManagedObjectMapping mappingForClass:[RKCat class] inManagedObjectStore:objectStore];
catMapping.primaryKeyAttribute = @"railsID";
[catMapping mapAttributes:@"name", nil];
@@ -195,7 +195,7 @@ - (void)testShouldLoadNestedHasManyRelationship {
}
- (void)testShouldMapNullToAHasManyRelationship {
- RKManagedObjectStore *objectStore = [RKTestFactory objectStore];
+ RKManagedObjectStore *objectStore = [RKTestFactory managedObjectStore];
RKManagedObjectMapping* catMapping = [RKManagedObjectMapping mappingForClass:[RKCat class] inManagedObjectStore:objectStore];
[catMapping mapAttributes:@"name", nil];
@@ -213,7 +213,7 @@ - (void)testShouldMapNullToAHasManyRelationship {
}
- (void)testShouldLoadNestedHasManyRelationshipWithoutABackingClass {
- RKManagedObjectStore* objectStore = [RKTestFactory objectStore];
+ RKManagedObjectStore* objectStore = [RKTestFactory managedObjectStore];
RKManagedObjectMapping* cloudMapping = [RKManagedObjectMapping mappingForEntityWithName:@"RKCloud" inManagedObjectStore:objectStore];
[cloudMapping mapAttributes:@"name", nil];
@@ -232,7 +232,7 @@ - (void)testShouldLoadNestedHasManyRelationshipWithoutABackingClass {
}
- (void)testShouldDynamicallyConnectRelationshipsByPrimaryKeyWhenMatchingSucceeds {
- RKManagedObjectStore* objectStore = [RKTestFactory objectStore];
+ RKManagedObjectStore* objectStore = [RKTestFactory managedObjectStore];
RKManagedObjectMapping* catMapping = [RKManagedObjectMapping mappingForClass:[RKCat class] inManagedObjectStore:objectStore];
catMapping.primaryKeyAttribute = @"railsID";
@@ -261,7 +261,7 @@ - (void)testShouldDynamicallyConnectRelationshipsByPrimaryKeyWhenMatchingSucceed
}
- (void)testShouldNotDynamicallyConnectRelationshipsByPrimaryKeyWhenMatchingFails {
- RKManagedObjectStore* objectStore = [RKTestFactory objectStore];
+ RKManagedObjectStore* objectStore = [RKTestFactory managedObjectStore];
RKManagedObjectMapping* catMapping = [RKManagedObjectMapping mappingForClass:[RKCat class] inManagedObjectStore:objectStore];
catMapping.primaryKeyAttribute = @"railsID";
@@ -289,7 +289,7 @@ - (void)testShouldNotDynamicallyConnectRelationshipsByPrimaryKeyWhenMatchingFail
}
- (void)testShouldConnectManyToManyRelationships {
- RKManagedObjectStore *store = [RKTestFactory objectStore];
+ RKManagedObjectStore *store = [RKTestFactory managedObjectStore];
RKManagedObjectMapping* childMapping = [RKManagedObjectMapping mappingForClass:[RKChild class] inManagedObjectStore:store];
childMapping.primaryKeyAttribute = @"railsID";
[childMapping mapAttributes:@"name", nil];
@@ -317,7 +317,7 @@ - (void)testShouldConnectManyToManyRelationships {
}
- (void)testShouldConnectRelationshipsByPrimaryKeyRegardlessOfOrder {
- RKManagedObjectStore *store = [RKTestFactory objectStore];
+ RKManagedObjectStore *store = [RKTestFactory managedObjectStore];
RKManagedObjectMapping* parentMapping = [RKManagedObjectMapping mappingForClass:[RKParent class] inManagedObjectStore:store];
[parentMapping mapAttributes:@"parentID", nil];
parentMapping.primaryKeyAttribute = @"parentID";
View
22 Tests/Logic/CoreData/RKManagedObjectMappingTest.m
@@ -44,7 +44,7 @@ @implementation RKManagedObjectMappingTest
- (void)testShouldReturnTheDefaultValueForACoreDataAttribute {
// Load Core Data
- RKManagedObjectStore *store = [RKTestFactory objectStore];
+ RKManagedObjectStore *store = [RKTestFactory managedObjectStore];
RKManagedObjectMapping* mapping = [RKManagedObjectMapping mappingForEntityWithName:@"RKCat" inManagedObjectStore:store];
id value = [mapping defaultValueForMissingAttribute:@"name"];
@@ -52,7 +52,7 @@ - (void)testShouldReturnTheDefaultValueForACoreDataAttribute {
}
- (void)testShouldCreateNewInstancesOfUnmanagedObjects {
- [RKTestFactory objectStore];
+ [RKTestFactory managedObjectStore];
RKObjectMapping* mapping = [RKObjectMapping mappingForClass:[RKMappableObject class]];
id object = [mapping mappableObjectForData:[NSDictionary dictionary]];
assertThat(object, isNot(nilValue()));
@@ -60,7 +60,7 @@ - (void)testShouldCreateNewInstancesOfUnmanagedObjects {
}
- (void)testShouldCreateNewInstancesOfManagedObjectsWhenTheMappingIsAnRKObjectMapping {
- [RKTestFactory objectStore];
+ [RKTestFactory managedObjectStore];
RKObjectMapping* mapping = [RKObjectMapping mappingForClass:[RKMappableObject class]];
id object = [mapping mappableObjectForData:[NSDictionary dictionary]];
assertThat(object, isNot(nilValue()));
@@ -68,7 +68,7 @@ - (void)testShouldCreateNewInstancesOfManagedObjectsWhenTheMappingIsAnRKObjectMa
}
- (void)testShouldFindExistingManagedObjectsByPrimaryKey {
- RKManagedObjectStore* store = [RKTestFactory objectStore];
+ RKManagedObjectStore* store = [RKTestFactory managedObjectStore];
RKManagedObjectMapping* mapping = [RKManagedObjectMapping mappingForClass:[RKHuman class] inManagedObjectStore:store];
mapping.primaryKeyAttribute = @"railsID";
[mapping addAttributeMapping:[RKObjectAttributeMapping mappingFromKeyPath:@"id" toKeyPath:@"railsID"]];
@@ -85,7 +85,7 @@ - (void)testShouldFindExistingManagedObjectsByPrimaryKey {
}
- (void)testShouldFindExistingManagedObjectsByPrimaryKeyPath {
- RKManagedObjectStore* store = [RKTestFactory objectStore];
+ RKManagedObjectStore* store = [RKTestFactory managedObjectStore];
[RKHuman truncateAll];
RKManagedObjectMapping* mapping = [RKManagedObjectMapping mappingForClass:[RKHuman class] inManagedObjectStore:store];
mapping.primaryKeyAttribute = @"railsID";
@@ -105,7 +105,7 @@ - (void)testShouldFindExistingManagedObjectsByPrimaryKeyPath {
}
- (void)testShouldCreateNewManagedObjectInstancesWhenThereIsNoPrimaryKeyInTheData {
- RKManagedObjectStore *store = [RKTestFactory objectStore];
+ RKManagedObjectStore *store = [RKTestFactory managedObjectStore];
RKManagedObjectMapping* mapping = [RKManagedObjectMapping mappingForClass:[RKHuman class] inManagedObjectStore:store];
mapping.primaryKeyAttribute = @"railsID";
@@ -116,7 +116,7 @@ - (void)testShouldCreateNewManagedObjectInstancesWhenThereIsNoPrimaryKeyInTheDat
}
- (void)testShouldCreateNewManagedObjectInstancesWhenThereIsNoPrimaryKeyAttribute {
- RKManagedObjectStore *store = [RKTestFactory objectStore];
+ RKManagedObjectStore *store = [RKTestFactory managedObjectStore];
RKManagedObjectMapping* mapping = [RKManagedObjectMapping mappingForClass:[RKHuman class] inManagedObjectStore:store];
NSDictionary* data = [NSDictionary dictionary];
@@ -126,7 +126,7 @@ - (void)testShouldCreateNewManagedObjectInstancesWhenThereIsNoPrimaryKeyAttribut
}
- (void)testShouldCreateANewManagedObjectWhenThePrimaryKeyValueIsNSNull {
- RKManagedObjectStore *store = [RKTestFactory objectStore];
+ RKManagedObjectStore *store = [RKTestFactory managedObjectStore];
RKManagedObjectMapping* mapping = [RKManagedObjectMapping mappingForClass:[RKHuman class] inManagedObjectStore:store];
mapping.primaryKeyAttribute = @"railsID";
[mapping addAttributeMapping:[RKObjectAttributeMapping mappingFromKeyPath:@"id" toKeyPath:@"railsID"]];
@@ -138,7 +138,7 @@ - (void)testShouldCreateANewManagedObjectWhenThePrimaryKeyValueIsNSNull {
}
- (void)testShouldMapACollectionOfObjectsWithDynamicKeys {
- RKManagedObjectStore *objectStore = [RKTestFactory objectStore];
+ RKManagedObjectStore *objectStore = [RKTestFactory managedObjectStore];
RKManagedObjectMapping *mapping = [RKManagedObjectMapping mappingForClass:[RKHuman class] inManagedObjectStore:objectStore];
mapping.forceCollectionMapping = YES;
mapping.primaryKeyAttribute = @"name";
@@ -164,7 +164,7 @@ - (void)testShouldMapACollectionOfObjectsWithDynamicKeys {
}
- (void)testShouldPickTheAppropriateMappingBasedOnAnAttributeValue {
- RKManagedObjectStore *objectStore = [RKTestFactory objectStore];
+ RKManagedObjectStore *objectStore = [RKTestFactory managedObjectStore];
RKDynamicObjectMapping* dynamicMapping = [RKDynamicObjectMapping dynamicMapping];
RKManagedObjectMapping* childMapping = [RKManagedObjectMapping mappingForClass:[RKChild class] inManagedObjectStore:objectStore];
childMapping.primaryKeyAttribute = @"railsID";
@@ -188,7 +188,7 @@ - (void)testShouldPickTheAppropriateMappingBasedOnAnAttributeValue {
}
- (void)testShouldIncludeTransformableAttributesInPropertyNamesAndTypes {
- [RKTestFactory objectStore];
+ [RKTestFactory managedObjectStore];
NSDictionary *attributesByName = [[RKHuman entity] attributesByName];
NSDictionary *propertiesByName = [[RKHuman entity] propertiesByName];
NSDictionary *relationshipsByName = [[RKHuman entity] relationshipsByName];
View
2  Tests/Logic/CoreData/RKManagedObjectStoreTest.m
@@ -29,7 +29,7 @@ @implementation RKManagedObjectStoreTest
- (void)testInstantiationOfNewManagedObjectContextAssociatesWithObjectStore
{
- RKManagedObjectStore *store = [RKTestFactory objectStore];
+ RKManagedObjectStore *store = [RKTestFactory managedObjectStore];
NSManagedObjectContext *context = [store newManagedObjectContext];
assertThat([context managedObjectStore], is(equalTo(store)));
}
View
22 Tests/Logic/CoreData/RKManagedObjectThreadSafeInvocationTest.m
@@ -34,8 +34,8 @@ @interface RKManagedObjectThreadSafeInvocationTest : RKTestCase {
@implementation RKManagedObjectThreadSafeInvocationTest
- (void)testShouldSerializeOneManagedObjectToManagedObjectID {
- RKManagedObjectStore* objectStore = [RKTestFactory objectStore];
- RKObjectManager *objectManager = RKTestNewObjectManager();
+ RKManagedObjectStore* objectStore = [RKTestFactory managedObjectStore];
+ RKObjectManager *objectManager = [RKTestFactory objectManager];
objectManager.objectStore = objectStore;
RKHuman* human = [RKHuman object];
NSMutableDictionary* dictionary = [NSMutableDictionary dictionaryWithObject:human forKey:@"human"];
@@ -46,8 +46,8 @@ - (void)testShouldSerializeOneManagedObjectToManagedObjectID {
}
- (void)testShouldSerializeCollectionOfManagedObjectsToManagedObjectIDs {
- RKManagedObjectStore* objectStore = [RKTestFactory objectStore];
- RKObjectManager *objectManager = RKTestNewObjectManager();
+ RKManagedObjectStore* objectStore = [RKTestFactory managedObjectStore];
+ RKObjectManager *objectManager = [RKTestFactory objectManager];
objectManager.objectStore = objectStore;
RKHuman* human1 = [RKHuman object];
RKHuman* human2 = [RKHuman object];
@@ -61,8 +61,8 @@ - (void)testShouldSerializeCollectionOfManagedObjectsToManagedObjectIDs {
}
- (void)testShouldDeserializeOneManagedObjectIDToManagedObject {
- RKManagedObjectStore* objectStore = [RKTestFactory objectStore];
- RKObjectManager *objectManager = RKTestNewObjectManager();
+ RKManagedObjectStore* objectStore = [RKTestFactory managedObjectStore];
+ RKObjectManager *objectManager = [RKTestFactory objectManager];
objectManager.objectStore = objectStore;
RKHuman* human = [RKHuman object];
NSMutableDictionary* dictionary = [NSMutableDictionary dictionaryWithObject:[human objectID] forKey:@"human"];
@@ -75,8 +75,8 @@ - (void)testShouldDeserializeOneManagedObjectIDToManagedObject {
}
- (void)testShouldDeserializeCollectionOfManagedObjectIDToManagedObjects {
- RKManagedObjectStore* objectStore = [RKTestFactory objectStore];
- RKObjectManager *objectManager = RKTestNewObjectManager();
+ RKManagedObjectStore* objectStore = [RKTestFactory managedObjectStore];
+ RKObjectManager *objectManager = [RKTestFactory objectManager];
objectManager.objectStore = objectStore;
RKHuman* human1 = [RKHuman object];
RKHuman* human2 = [RKHuman object];
@@ -105,8 +105,8 @@ - (void)createBackgroundObjects {
// Assert this is not the main thread
// Create a new array of objects in the background
- RKObjectManager *objectManager = RKTestNewObjectManager();
- objectManager.objectStore = [RKTestFactory objectStore];
+ RKObjectManager *objectManager = [RKTestFactory objectManager];
+ objectManager.objectStore = [RKTestFactory managedObjectStore];
NSArray* humans = [NSArray arrayWithObject:[RKHuman object]];
_dictionary = [[NSMutableDictionary dictionaryWithObject:humans forKey:@"humans"] retain];
NSMethodSignature* signature = [self methodSignatureForSelector:@selector(informDelegateWithDictionary:)];
@@ -123,7 +123,7 @@ - (void)createBackgroundObjects {
}
- (void)testShouldSerializeAndDeserializeManagedObjectsAcrossAThreadInvocation {
- _objectStore = [[RKTestFactory objectStore] retain];
+ _objectStore = [[RKTestFactory managedObjectStore] retain];
_waiting = YES;
[self performSelectorInBackground:@selector(createBackgroundObjects) withObject:nil];
View
4 Tests/Logic/CoreData/RKSearchWordObserverTest.m
@@ -17,12 +17,12 @@ @interface RKSearchWordObserverTest : RKTestCase
@implementation RKSearchWordObserverTest
- (void)testInstantiateASearchWordObserverOnObjectStoreInit {
- [RKTestFactory objectStore];
+ [RKTestFactory managedObjectStore];
assertThat([RKSearchWordObserver sharedObserver], isNot(nil));
}
- (void)testTriggerSearchWordRegenerationForChagedSearchableValuesAtObjectContextSaveTime {
- RKManagedObjectStore* store = [RKTestFactory objectStore];
+ RKManagedObjectStore* store = [RKTestFactory managedObjectStore];
RKSearchable* searchable = [RKSearchable createEntity];
searchable.title = @"This is the title of my new object";
assertThat(searchable.searchWords, is(empty()));
View
2  Tests/Logic/CoreData/RKSearchableManagedObjectTest.m
@@ -17,7 +17,7 @@ @interface RKSearchableManagedObjectTest : RKTestCase
@implementation RKSearchableManagedObjectTest
- (void)testGenerateSearchWordsForSearchableObjects {
- [RKTestFactory objectStore];
+ [RKTestFactory managedObjectStore];
RKSearchable* searchable = [RKSearchable createEntity];
searchable.title = @"This is the title of my new object";
searchable.body = @"This is the point at which I begin pontificating at length about various and sundry things for no real reason at all. Furthermore, ...";
View
8 Tests/Logic/Network/RKAuthenticationTest.m
@@ -34,7 +34,7 @@ @implementation RKAuthenticationTest
- (void)testShouldAccessUnprotectedResourcePaths {
RKTestResponseLoader* loader = [RKTestResponseLoader responseLoader];
- RKClient* client = RKTestNewClient();
+ RKClient* client = [RKTestFactory client];
[client get:@"/authentication/none" delegate:loader];
[loader waitForResponse];
assertThatBool([loader.response isOK], is(equalToBool(YES)));
@@ -42,7 +42,7 @@ - (void)testShouldAccessUnprotectedResourcePaths {
- (void)testShouldAuthenticateViaHTTPAuthBasic {
RKTestResponseLoader* loader = [RKTestResponseLoader responseLoader];
- RKClient* client = RKTestNewClient();
+ RKClient* client = [RKTestFactory client];
client.username = RKAuthenticationTestUsername;
client.password = RKAuthenticationTestPassword;
[client get:@"/authentication/basic" delegate:loader];
@@ -52,7 +52,7 @@ - (void)testShouldAuthenticateViaHTTPAuthBasic {
- (void)testShouldFailAuthenticationWithInvalidCredentialsForHTTPAuthBasic {
RKTestResponseLoader* loader = [RKTestResponseLoader responseLoader];
- RKClient* client = RKTestNewClient();
+ RKClient* client = [RKTestFactory client];
client.username = RKAuthenticationTestUsername;
client.password = @"INVALID";
[client get:@"/authentication/basic" delegate:loader];
@@ -64,7 +64,7 @@ - (void)testShouldFailAuthenticationWithInvalidCredentialsForHTTPAuthBasic {
- (void)testShouldAuthenticateViaHTTPAuthDigest {
RKTestResponseLoader* loader = [RKTestResponseLoader responseLoader];
- RKClient* client = RKTestNewClient();
+ RKClient* client = [RKTestFactory client];
client.username = RKAuthenticationTestUsername;
client.password = RKAuthenticationTestPassword;
[client get:@"/authentication/digest" delegate:loader];
View
6 Tests/Logic/Network/RKClientTest.m
@@ -22,9 +22,7 @@
#import "RKTestEnvironment.h"
#import "RKURL.h"
-@interface RKClientTest : RKTestCase {
-}
-
+@interface RKClientTest : RKTestCase
@end
@@ -86,7 +84,7 @@ - (void)testShouldAllowYouToChangeTheBaseURL {
}
- (void)testShouldLetYouChangeTheHTTPAuthCredentials {
- RKClient *client = RKTestNewClient();
+ RKClient *client = [RKTestFactory client];
client.authenticationType = RKRequestAuthenticationTypeHTTP;
client.username = @"invalid";
client.password = @"password";
View
8 Tests/Logic/Network/RKParamsTest.m
@@ -31,7 +31,7 @@ @implementation RKParamsTest
- (void)testShouldNotOverReleaseTheParams {
NSDictionary* dictionary = [NSDictionary dictionaryWithObject:@"foo" forKey:@"bar"];
RKParams* params = [[RKParams alloc] initWithDictionary:dictionary];
- NSURL* URL = [NSURL URLWithString:[RKTestGetBaseURLString() stringByAppendingFormat:@"/echo_params"]];
+ NSURL* URL = [NSURL URLWithString:[[RKTestFactory baseURLString] stringByAppendingFormat:@"/echo_params"]];
RKTestResponseLoader* responseLoader = [RKTestResponseLoader responseLoader];
RKRequest* request = [[RKRequest alloc] initWithURL:URL];
request.method = RKRequestMethodPOST;
@@ -43,7 +43,7 @@ - (void)testShouldNotOverReleaseTheParams {
}
- (void)testShouldUploadFilesViaRKParams {
- RKClient* client = RKTestNewClient();
+ RKClient* client = [RKTestFactory client];
RKParams* params = [RKParams params];
[params setValue:@"one" forParam:@"value"];
[params setValue:@"two" forParam:@"value"];
@@ -87,7 +87,7 @@ - (void)testShouldUploadFilesViaRKParamsWithMixedTypes {
[params setValue:lon forParam:@"lon"];
[params setValue:lat forParam:@"lat"];
- RKClient* client = RKTestNewClient();
+ RKClient* client = [RKTestFactory client];
RKTestResponseLoader* responseLoader = [RKTestResponseLoader responseLoader];
[client post:@"/upload" params:params delegate:responseLoader];
[responseLoader waitForResponse];
@@ -102,7 +102,7 @@ - (void)testShouldCalculateAnMD5ForTheParams {
}
- (void)testShouldProperlyCalculateContentLengthForFileUploads {
- RKClient* client = RKTestNewClient();
+ RKClient* client = [RKTestFactory client];
RKParams* params = [RKParams params];
[params setValue:@"one" forParam:@"value"];
[params setValue:@"two" forParam:@"value"];
View
12 Tests/Logic/Network/RKRequestQueueTest.m
@@ -102,7 +102,7 @@ - (void)testShouldInformTheDelegateOnTransitionFromEmptyToProcessing {
OCMockObject* delegateMock = [OCMockObject niceMockForProtocol:@protocol(RKRequestQueueDelegate)];
[[delegateMock expect] requestQueueDidBeginLoading:queue];
queue.delegate = (NSObject<RKRequestQueueDelegate>*) delegateMock;
- NSURL* URL = RKTestGetBaseURL();
+ NSURL* URL = [RKTestFactory baseURL];
RKRequest* request = [[RKRequest alloc] initWithURL:URL];
[queue addLoadingRequest:request];
[delegateMock verify];
@@ -114,7 +114,7 @@ - (void)testShouldInformTheDelegateOnTransitionFromProcessingToEmpty {
OCMockObject* delegateMock = [OCMockObject niceMockForProtocol:@protocol(RKRequestQueueDelegate)];
[[delegateMock expect] requestQueueDidFinishLoading:queue];
queue.delegate = (NSObject<RKRequestQueueDelegate>*) delegateMock;
- NSURL* URL = RKTestGetBaseURL();
+ NSURL* URL = [RKTestFactory baseURL];
RKRequest* request = [[RKRequest alloc] initWithURL:URL];
[queue addLoadingRequest:request];
[queue removeLoadingRequest:request];
@@ -126,7 +126,7 @@ - (void)testShouldInformTheDelegateOnTransitionFromProcessingToEmptyForQueuesWit
OCMockObject* delegateMock = [OCMockObject niceMockForProtocol:@protocol(RKRequestQueueDelegate)];
RKTestResponseLoader* loader = [RKTestResponseLoader responseLoader];
- NSString* url = [NSString stringWithFormat:@"%@/ok-with-delay/0.3", RKTestGetBaseURLString()];
+ NSString* url = [NSString stringWithFormat:@"%@/ok-with-delay/0.3", [RKTestFactory baseURLString]];
NSURL* URL = [NSURL URLWithString:url];
RKRequest * request = [[RKRequest alloc] initWithURL:URL];
request.delegate = loader;
@@ -171,14 +171,14 @@ - (void)testShouldInformTheDelegateOnTransitionFromProcessingToEmptyForQueuesWit
//
// RKRequestQueue *queue1 = [RKRequestQueue new];
// queue1.showsNetworkActivityIndicatorWhenBusy = YES;
-// NSString* url1 = [NSString stringWithFormat:@"%@/ok-with-delay/2.0", RKTestGetBaseURL()];
+// NSString* url1 = [NSString stringWithFormat:@"%@/ok-with-delay/2.0", [RKTestFactory baseURL]];
// NSURL* URL1 = [NSURL URLWithString:url1];
// RKRequest * request1 = [[RKRequest alloc] initWithURL:URL1];
// request1.delegate = loader;
//
// RKRequestQueue *queue2 = [RKRequestQueue new];
// queue2.showsNetworkActivityIndicatorWhenBusy = YES;
-// NSString* url2 = [NSString stringWithFormat:@"%@/ok-with-delay/2.0", RKTestGetBaseURL()];
+// NSString* url2 = [NSString stringWithFormat:@"%@/ok-with-delay/2.0", [RKTestFactory baseURL]];
// NSURL* URL2 = [NSURL URLWithString:url2];
// RKRequest * request2 = [[RKRequest alloc] initWithURL:URL2];
// request2.delegate = loader;
@@ -246,7 +246,7 @@ - (void)testShouldReturnNilIfNewRequestQueueWithNameIsCalledForAnExistingName {
- (void)testShouldRemoveItemsFromTheQueueWithAnUnmappableResponse {
RKRequestQueue *queue = [RKRequestQueue requestQueue];
- RKObjectManager *objectManager = RKTestNewObjectManager();
+ RKObjectManager *objectManager = [RKTestFactory objectManager];
RKTestResponseLoader *loader = [RKTestResponseLoader responseLoader];
RKObjectLoader *objectLoader = [objectManager loaderWithResourcePath:@"/403"];
objectLoader.delegate = loader;
View
110 Tests/Logic/Network/RKRequestTest.m
@@ -42,7 +42,7 @@ - (void)setUp {
[RKTestFactory setUp];
// Clear the cache directory
- RKTestClearCacheDirectory();
+ [RKTestFactory clearCacheDirectory];
_methodInvocationCounter = 0;
}
@@ -72,7 +72,7 @@ - (void)testShouldSendMultiPartRequests {
#pragma mark - Basics
- (void)testShouldSetURLRequestHTTPBody {
- NSURL* URL = [NSURL URLWithString:RKTestGetBaseURLString()];
+ NSURL* URL = [NSURL URLWithString:[RKTestFactory baseURLString]];
RKRequest* request = [[RKRequest alloc] initWithURL:URL];
NSString* JSON = @"whatever";
NSData* data = [JSON dataUsingEncoding:NSASCIIStringEncoding];
@@ -83,7 +83,7 @@ - (void)testShouldSetURLRequestHTTPBody {
}
- (void)testShouldSetURLRequestHTTPBodyByString {
- NSURL* URL = [NSURL URLWithString:RKTestGetBaseURLString()];
+ NSURL* URL = [NSURL URLWithString:[RKTestFactory baseURLString]];
RKRequest* request = [[RKRequest alloc] initWithURL:URL];
NSString* JSON = @"whatever";
NSData* data = [JSON dataUsingEncoding:NSASCIIStringEncoding];
@@ -96,7 +96,7 @@ - (void)testShouldSetURLRequestHTTPBodyByString {
- (void)testShouldTimeoutAtIntervalWhenSentAsynchronously {
RKTestResponseLoader* loader = [RKTestResponseLoader responseLoader];
id loaderMock = [OCMockObject partialMockForObject:loader];
- NSURL* URL = [RKTestGetBaseURL() URLByAppendingResourcePath:@"/timeout"];
+ NSURL* URL = [[RKTestFactory baseURL] URLByAppendingResourcePath:@"/timeout"];
RKRequest* request = [[RKRequest alloc] initWithURL:URL];
request.delegate = loaderMock;
request.timeoutInterval = 3.0;
@@ -110,7 +110,7 @@ - (void)testShouldTimeoutAtIntervalWhenSentAsynchronously {
- (void)testShouldTimeoutAtIntervalWhenSentSynchronously {
RKTestResponseLoader* loader = [RKTestResponseLoader responseLoader];
id loaderMock = [OCMockObject partialMockForObject:loader];
- NSURL* URL = [RKTestGetBaseURL() URLByAppendingResourcePath:@"/timeout"];
+ NSURL* URL = [[RKTestFactory baseURL] URLByAppendingResourcePath:@"/timeout"];
RKRequest* request = [[RKRequest alloc] initWithURL:URL];
request.delegate = loaderMock;
request.timeoutInterval = 3.0;
@@ -122,7 +122,7 @@ - (void)testShouldTimeoutAtIntervalWhenSentSynchronously {
- (void)testShouldCreateOneTimeoutTimerWhenSentAsynchronously {
RKTestResponseLoader* loader = [RKTestResponseLoader responseLoader];
- RKRequest* request = [[RKRequest alloc] initWithURL:RKTestGetBaseURL()];
+ RKRequest* request = [[RKRequest alloc] initWithURL:[RKTestFactory baseURL]];
request.delegate = loader;
id requestMock = [OCMockObject partialMockForObject:request];
[[[requestMock expect] andCall:@selector(incrementMethodInvocationCounter) onObject:self] createTimeoutTimer];
@@ -135,7 +135,7 @@ - (void)testShouldCreateOneTimeoutTimerWhenSentAsynchronously {
- (void)testThatSendingDataInvalidatesTimeoutTimer {
RKTestResponseLoader* loader = [RKTestResponseLoader responseLoader];
loader.timeout = 3.0;
- NSURL* URL = [RKTestGetBaseURL() URLByAppendingResourcePath:@"/timeout"];
+ NSURL* URL = [[RKTestFactory baseURL] URLByAppendingResourcePath:@"/timeout"];
RKRequest* request = [[RKRequest alloc] initWithURL:URL];
request.method = RKRequestMethodPOST;
request.delegate = loader;
@@ -152,7 +152,7 @@ - (void)testThatSendingDataInvalidatesTimeoutTimer {
#if TARGET_OS_IPHONE
- (void)testShouldSendTheRequestWhenBackgroundPolicyIsRKRequestBackgroundPolicyNone {
- NSURL* URL = RKTestGetBaseURL();
+ NSURL* URL = [RKTestFactory baseURL];
RKRequest* request = [[RKRequest alloc] initWithURL:URL];
request.backgroundPolicy = RKRequestBackgroundPolicyNone;
id requestMock = [OCMockObject partialMockForObject:request];
@@ -175,9 +175,9 @@ - (void)stubSharedApplicationWhileExecutingBlock:(void (^)(void))block {
}
- (void)testShouldObserveForAppBackgroundTransitionsAndCancelTheRequestWhenBackgroundPolicyIsRKRequestBackgroundPolicyCancel {
- RKTestNewClient();
+ [RKTestFactory client];
[self stubSharedApplicationWhileExecutingBlock:^{
- NSURL* URL = RKTestGetBaseURL();
+ NSURL* URL = [RKTestFactory baseURL];
RKRequest* request = [[RKRequest alloc] initWithURL:URL];
request.backgroundPolicy = RKRequestBackgroundPolicyCancel;
id requestMock = [OCMockObject partialMockForObject:request];
@@ -190,10 +190,10 @@ - (void)testShouldObserveForAppBackgroundTransitionsAndCancelTheRequestWhenBackg
}
- (void)testShouldInformTheDelegateOfCancelWhenTheRequestWhenBackgroundPolicyIsRKRequestBackgroundPolicyCancel {
- RKTestNewClient();
+ [RKTestFactory client];
[self stubSharedApplicationWhileExecutingBlock:^{
RKTestResponseLoader* loader = [RKTestResponseLoader responseLoader];
- NSURL* URL = RKTestGetBaseURL();
+ NSURL* URL = [RKTestFactory baseURL];
RKRequest* request = [[RKRequest alloc] initWithURL:URL];
request.backgroundPolicy = RKRequestBackgroundPolicyCancel;
request.delegate = loader;
@@ -205,9 +205,9 @@ - (void)testShouldInformTheDelegateOfCancelWhenTheRequestWhenBackgroundPolicyIsR
}
- (void)testShouldDeallocTheRequestWhenBackgroundPolicyIsRKRequestBackgroundPolicyCancel {
- RKTestNewClient();
+ [RKTestFactory client];
RKTestResponseLoader* loader = [RKTestResponseLoader responseLoader];
- NSURL* URL = RKTestGetBaseURL();
+ NSURL* URL = [RKTestFactory baseURL];
RKRequest* request = [[RKRequest alloc] initWithURL:URL];
request.backgroundPolicy = RKRequestBackgroundPolicyCancel;
request.delegate = loader;
@@ -222,7 +222,7 @@ - (void)testShouldPutTheRequestBackOntoTheQueueWhenBackgroundPolicyIsRKRequestBa
RKRequestQueue* queue = [RKRequestQueue new];
queue.suspended = YES;
RKTestResponseLoader* loader = [RKTestResponseLoader responseLoader];
- NSURL* URL = RKTestGetBaseURL();
+ NSURL* URL = [RKTestFactory baseURL];
RKRequest* request = [[RKRequest alloc] initWithURL:URL];
request.backgroundPolicy = RKRequestBackgroundPolicyRequeue;
request.delegate = loader;
@@ -236,7 +236,7 @@ - (void)testShouldPutTheRequestBackOntoTheQueueWhenBackgroundPolicyIsRKRequestBa
}
- (void)testShouldCreateABackgroundTaskWhenBackgroundPolicyIsRKRequestBackgroundPolicyContinue {
- NSURL* URL = RKTestGetBaseURL();
+ NSURL* URL = [RKTestFactory baseURL];
RKRequest* request = [[RKRequest alloc] initWithURL:URL];
request.backgroundPolicy = RKRequestBackgroundPolicyContinue;
[request sendAsynchronously];
@@ -245,7 +245,7 @@ - (void)testShouldCreateABackgroundTaskWhenBackgroundPolicyIsRKRequestBackground
- (void)testShouldSendTheRequestWhenBackgroundPolicyIsNone {
RKTestResponseLoader* loader = [RKTestResponseLoader responseLoader];
- NSURL* URL = RKTestGetBaseURL();
+ NSURL* URL = [RKTestFactory baseURL];
RKRequest* request = [[RKRequest alloc] initWithURL:URL];
request.backgroundPolicy = RKRequestBackgroundPolicyNone;
request.delegate = loader;
@@ -256,7 +256,7 @@ - (void)testShouldSendTheRequestWhenBackgroundPolicyIsNone {
- (void)testShouldSendTheRequestWhenBackgroundPolicyIsContinue {
RKTestResponseLoader* loader = [RKTestResponseLoader responseLoader];
- NSURL* URL = RKTestGetBaseURL();
+ NSURL* URL = [RKTestFactory baseURL];
RKRequest* request = [[RKRequest alloc] initWithURL:URL];
request.backgroundPolicy = RKRequestBackgroundPolicyContinue;
request.delegate = loader;
@@ -267,7 +267,7 @@ - (void)testShouldSendTheRequestWhenBackgroundPolicyIsContinue {
- (void)testShouldSendTheRequestWhenBackgroundPolicyIsCancel {
RKTestResponseLoader* loader = [RKTestResponseLoader responseLoader];
- NSURL* URL = RKTestGetBaseURL();
+ NSURL* URL = [RKTestFactory baseURL];
RKRequest* request = [[RKRequest alloc] initWithURL:URL];
request.backgroundPolicy = RKRequestBackgroundPolicyCancel;
request.delegate = loader;
@@ -278,7 +278,7 @@ - (void)testShouldSendTheRequestWhenBackgroundPolicyIsCancel {
- (void)testShouldSendTheRequestWhenBackgroundPolicyIsRequeue {
RKTestResponseLoader* loader = [RKTestResponseLoader responseLoader];
- NSURL* URL = RKTestGetBaseURL();
+ NSURL* URL = [RKTestFactory baseURL];
RKRequest* request = [[RKRequest alloc] initWithURL:URL];
request.backgroundPolicy = RKRequestBackgroundPolicyRequeue;
request.delegate = loader;
@@ -293,7 +293,7 @@ - (void)testShouldSendTheRequestWhenBackgroundPolicyIsRequeue {
- (void)testShouldSendTheRequestWhenTheCachePolicyIsNone {
RKTestResponseLoader* loader = [RKTestResponseLoader responseLoader];
- NSString* url = [NSString stringWithFormat:@"%@/etags", RKTestGetBaseURLString()];
+ NSString* url = [NSString stringWithFormat:@"%@/etags", [RKTestFactory baseURLString]];
NSURL* URL = [NSURL URLWithString:url];
RKRequest* request = [[RKRequest alloc] initWithURL:URL];
request.cachePolicy = RKRequestCachePolicyNone;
@@ -304,7 +304,7 @@ - (void)testShouldSendTheRequestWhenTheCachePolicyIsNone {
}
- (void)testShouldCacheTheRequestHeadersAndBodyIncludingOurOwnCustomTimestampHeader {
- NSString* baseURL = RKTestGetBaseURLString();
+ NSString* baseURL = [RKTestFactory baseURLString];
NSString* cacheDirForClient = [NSString stringWithFormat:@"RKClientRequestCache-%@",
[[NSURL URLWithString:baseURL] host]];
NSString* cachePath = [[RKDirectory cachesDirectory]
@@ -314,7 +314,7 @@ - (void)testShouldCacheTheRequestHeadersAndBodyIncludingOurOwnCustomTimestampHea
[cache invalidateWithStoragePolicy:RKRequestCacheStoragePolicyPermanently];
RKTestResponseLoader* loader = [RKTestResponseLoader responseLoader];
- NSString* url = [NSString stringWithFormat:@"%@/etags/cached", RKTestGetBaseURLString()];
+ NSString* url = [NSString stringWithFormat:@"%@/etags/cached", [RKTestFactory baseURLString]];
NSURL* URL = [NSURL URLWithString:url];
RKRequest* request = [[RKRequest alloc] initWithURL:URL];
request.cachePolicy = RKRequestCachePolicyEtag;
@@ -330,7 +330,7 @@ - (void)testShouldCacheTheRequestHeadersAndBodyIncludingOurOwnCustomTimestampHea
}
- (void)testShouldGenerateAUniqueCacheKeyBasedOnTheUrlTheMethodAndTheHTTPBody {
- NSString* baseURL = RKTestGetBaseURLString();
+ NSString* baseURL = [RKTestFactory baseURLString];
NSString* cacheDirForClient = [NSString stringWithFormat:@"RKClientRequestCache-%@",
[[NSURL URLWithString:baseURL] host]];
NSString* cachePath = [[RKDirectory cachesDirectory]
@@ -339,7 +339,7 @@ - (void)testShouldGenerateAUniqueCacheKeyBasedOnTheUrlTheMethodAndTheHTTPBody {
storagePolicy:RKRequestCacheStoragePolicyPermanently];
[cache invalidateWithStoragePolicy:RKRequestCacheStoragePolicyPermanently];
- NSString* url = [NSString stringWithFormat:@"%@/etags/cached", RKTestGetBaseURLString()];
+ NSString* url = [NSString stringWithFormat:@"%@/etags/cached", [RKTestFactory baseURLString]];
NSURL* URL = [NSURL URLWithString:url];
RKRequest* request = [[RKRequest alloc] initWithURL:URL];
request.cachePolicy = RKRequestCachePolicyEtag;
@@ -355,7 +355,7 @@ - (void)testShouldGenerateAUniqueCacheKeyBasedOnTheUrlTheMethodAndTheHTTPBody {
}
- (void)testShouldLoadFromCacheWhenWeRecieveA304 {
- NSString* baseURL = RKTestGetBaseURLString();
+ NSString* baseURL = [RKTestFactory baseURLString];
NSString* cacheDirForClient = [NSString stringWithFormat:@"RKClientRequestCache-%@",
[[NSURL URLWithString:baseURL] host]];
NSString* cachePath = [[RKDirectory cachesDirectory]
@@ -365,7 +365,7 @@ - (void)testShouldLoadFromCacheWhenWeRecieveA304 {
[cache invalidateWithStoragePolicy:RKRequestCacheStoragePolicyPermanently];
{
RKTestResponseLoader* loader = [RKTestResponseLoader responseLoader];
- NSString* url = [NSString stringWithFormat:@"%@/etags/cached", RKTestGetBaseURLString()];
+ NSString* url = [NSString stringWithFormat:@"%@/etags/cached", [RKTestFactory baseURLString]];
NSURL* URL = [NSURL URLWithString:url];
RKRequest* request = [[RKRequest alloc] initWithURL:URL];
request.cachePolicy = RKRequestCachePolicyEtag;
@@ -380,7 +380,7 @@ - (void)testShouldLoadFromCacheWhenWeRecieveA304 {
}
{
RKTestResponseLoader* loader = [RKTestResponseLoader responseLoader];
- NSString* url = [NSString stringWithFormat:@"%@/etags/cached", RKTestGetBaseURLString()];
+ NSString* url = [NSString stringWithFormat:@"%@/etags/cached", [RKTestFactory baseURLString]];
NSURL* URL = [NSURL URLWithString:url];
RKRequest* request = [[RKRequest alloc] initWithURL:URL];
request.cachePolicy = RKRequestCachePolicyEtag;
@@ -395,7 +395,7 @@ - (void)testShouldLoadFromCacheWhenWeRecieveA304 {
}
- (void)testShouldUpdateTheInternalCacheDateWhenWeRecieveA304 {
- NSString* baseURL = RKTestGetBaseURLString();
+ NSString* baseURL = [RKTestFactory baseURLString];
NSString* cacheDirForClient = [NSString stringWithFormat:@"RKClientRequestCache-%@",
[[NSURL URLWithString:baseURL] host]];
NSString* cachePath = [[RKDirectory cachesDirectory]
@@ -408,7 +408,7 @@ - (void)testShouldUpdateTheInternalCacheDateWhenWeRecieveA304 {
NSDate* internalCacheDate2;
{
RKTestResponseLoader* loader = [RKTestResponseLoader responseLoader];
- NSString* url = [NSString stringWithFormat:@"%@/etags/cached", RKTestGetBaseURLString()];
+ NSString* url = [NSString stringWithFormat:@"%@/etags/cached", [RKTestFactory baseURLString]];
NSURL* URL = [NSURL URLWithString:url];
RKRequest* request = [[RKRequest alloc] initWithURL:URL];
request.cachePolicy = RKRequestCachePolicyEtag;
@@ -425,7 +425,7 @@ - (void)testShouldUpdateTheInternalCacheDateWhenWeRecieveA304 {
[[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:1.5]];
{
RKTestResponseLoader* loader = [RKTestResponseLoader responseLoader];
- NSString* url = [NSString stringWithFormat:@"%@/etags/cached", RKTestGetBaseURLString()];
+ NSString* url = [NSString stringWithFormat:@"%@/etags/cached", [RKTestFactory baseURLString]];
NSURL* URL = [NSURL URLWithString:url];
RKRequest* request = [[RKRequest alloc] initWithURL:URL];
request.cachePolicy = RKRequestCachePolicyEtag;
@@ -442,7 +442,7 @@ - (void)testShouldUpdateTheInternalCacheDateWhenWeRecieveA304 {
}
- (void)testShouldLoadFromTheCacheIfThereIsAnError {
- NSString* baseURL = RKTestGetBaseURLString();
+ NSString* baseURL = [RKTestFactory baseURLString];
NSString* cacheDirForClient = [NSString stringWithFormat:@"RKClientRequestCache-%@",
[[NSURL URLWithString:baseURL] host]];
NSString* cachePath = [[RKDirectory cachesDirectory]
@@ -453,7 +453,7 @@ - (void)testShouldLoadFromTheCacheIfThereIsAnError {
{
RKTestResponseLoader* loader = [RKTestResponseLoader responseLoader];
- NSString* url = [NSString stringWithFormat:@"%@/etags/cached", RKTestGetBaseURLString()];
+ NSString* url = [NSString stringWithFormat:@"%@/etags/cached", [RKTestFactory baseURLString]];
NSURL* URL = [NSURL URLWithString:url];
RKRequest* request = [[RKRequest alloc] initWithURL:URL];
request.cachePolicy = RKRequestCachePolicyEtag;
@@ -467,7 +467,7 @@ - (void)testShouldLoadFromTheCacheIfThereIsAnError {
}
{
RKTestResponseLoader* loader = [RKTestResponseLoader responseLoader];
- NSString* url = [NSString stringWithFormat:@"%@/etags/cached", RKTestGetBaseURLString()];
+ NSString* url = [NSString stringWithFormat:@"%@/etags/cached", [RKTestFactory baseURLString]];
NSURL* URL = [NSURL URLWithString:url];
RKRequest* request = [[RKRequest alloc] initWithURL:URL];
request.cachePolicy = RKRequestCachePolicyLoadOnError;
@@ -480,7 +480,7 @@ - (void)testShouldLoadFromTheCacheIfThereIsAnError {
}
- (void)testShouldLoadFromTheCacheIfWeAreWithinTheTimeout {
- NSString* baseURL = RKTestGetBaseURLString();
+ NSString* baseURL = [RKTestFactory baseURLString];
NSString* cacheDirForClient = [NSString stringWithFormat:@"RKClientRequestCache-%@",
[[NSURL URLWithString:baseURL] host]];
NSString* cachePath = [[RKDirectory cachesDirectory]
@@ -489,7 +489,7 @@ - (void)testShouldLoadFromTheCacheIfWeAreWithinTheTimeout {
storagePolicy:RKRequestCacheStoragePolicyPermanently];
[cache invalidateWithStoragePolicy:RKRequestCacheStoragePolicyPermanently];
- NSString* url = [NSString stringWithFormat:@"%@/disk/cached", RKTestGetBaseURLString()];
+ NSString* url = [NSString stringWithFormat:@"%@/disk/cached", [RKTestFactory baseURLString]];
NSURL* URL = [NSURL URLWithString:url];
{
RKTestResponseLoader* loader = [RKTestResponseLoader responseLoader];
@@ -544,7 +544,7 @@ - (void)testShouldLoadFromTheCacheIfWeAreWithinTheTimeout {
}
- (void)testShouldLoadFromTheCacheIfWeAreOffline {
- NSString* baseURL = RKTestGetBaseURLString();
+ NSString* baseURL = [RKTestFactory baseURLString];
NSString* cacheDirForClient = [NSString stringWithFormat:@"RKClientRequestCache-%@",
[[NSURL URLWithString:baseURL] host]];
NSString* cachePath = [[RKDirectory cachesDirectory]
@@ -556,7 +556,7 @@ - (void)testShouldLoadFromTheCacheIfWeAreOffline {
{
RKTestResponseLoader* loader = [RKTestResponseLoader responseLoader];
loader.timeout = 60;
- NSString* url = [NSString stringWithFormat:@"%@/etags/cached", RKTestGetBaseURLString()];
+ NSString* url = [NSString stringWithFormat:@"%@/etags/cached", [RKTestFactory baseURLString]];
NSURL* URL = [NSURL URLWithString:url];
RKRequest* request = [[RKRequest alloc] initWithURL:URL];
request.cachePolicy = RKRequestCachePolicyEtag;
@@ -571,7 +571,7 @@ - (void)testShouldLoadFromTheCacheIfWeAreOffline {
{
RKTestResponseLoader* loader = [RKTestResponseLoader responseLoader];
loader.timeout = 60;
- NSString* url = [NSString stringWithFormat:@"%@/etags/cached", RKTestGetBaseURLString()];
+ NSString* url = [NSString stringWithFormat:@"%@/etags/cached", [RKTestFactory baseURLString]];
NSURL* URL = [NSURL URLWithString:url];
RKRequest* request = [[RKRequest alloc] initWithURL:URL];
request.cachePolicy = RKRequestCachePolicyLoadIfOffline;
@@ -587,7 +587,7 @@ - (void)testShouldLoadFromTheCacheIfWeAreOffline {
}
- (void)testShouldCacheTheStatusCodeMIMETypeAndURL {
- NSString* baseURL = RKTestGetBaseURLString();
+ NSString* baseURL = [RKTestFactory baseURLString];
NSString* cacheDirForClient = [NSString stringWithFormat:@"RKClientRequestCache-%@",
[[NSURL URLWithString:baseURL] host]];
NSString* cachePath = [[RKDirectory cachesDirectory]
@@ -598,7 +598,7 @@ - (void)testShouldCacheTheStatusCodeMIMETypeAndURL {
[cache invalidateWithStoragePolicy:RKRequestCacheStoragePolicyPermanently];
{
RKTestResponseLoader* loader = [RKTestResponseLoader responseLoader];
- NSString* url = [NSString stringWithFormat:@"%@/etags/cached", RKTestGetBaseURLString()];
+ NSString* url = [NSString stringWithFormat:@"%@/etags/cached", [RKTestFactory baseURLString]];
NSURL* URL = [NSURL URLWithString:url];
RKRequest* request = [[RKRequest alloc] initWithURL:URL];
request.cachePolicy = RKRequestCachePolicyEtag;
@@ -614,7 +614,7 @@ - (void)testShouldCacheTheStatusCodeMIMETypeAndURL {
}
{
RKTestResponseLoader* loader = [RKTestResponseLoader responseLoader];
- NSString* url = [NSString stringWithFormat:@"%@/etags/cached", RKTestGetBaseURLString()];
+ NSString* url = [NSString stringWithFormat:@"%@/etags/cached", [RKTestFactory baseURLString]];
NSURL* URL = [NSURL URLWithString:url];
RKRequest* request = [[RKRequest alloc] initWithURL:URL];
request.cachePolicy = RKRequestCachePolicyEtag;
@@ -636,7 +636,7 @@ - (void)testShouldPostSimpleKeyValuesViaRKParams {
[params setValue: @"hello" forParam:@"username"];
[params setValue: @"password" forParam:@"password"];
- RKClient* client = RKTestNewClient();
+ RKClient* client = [RKTestFactory client];
client.cachePolicy = RKRequestCachePolicyNone;
RKTestResponseLoader* loader = [RKTestResponseLoader responseLoader];
loader.timeout = 20;
@@ -646,7 +646,7 @@ - (void)testShouldPostSimpleKeyValuesViaRKParams {
}
- (void)testShouldSetAnEmptyContentBodyWhenParamsIsNil {
- RKClient* client = RKTestNewClient();
+ RKClient* client = [RKTestFactory client];
client.cachePolicy = RKRequestCachePolicyNone;
RKTestResponseLoader* loader = [RKTestResponseLoader responseLoader];
loader.timeout = 20;
@@ -656,7 +656,7 @@ - (void)testShouldSetAnEmptyContentBodyWhenParamsIsNil {
}
- (void)testShouldSetAnEmptyContentBodyWhenQueryParamsIsAnEmptyDictionary {
- RKClient* client = RKTestNewClient();
+ RKClient* client = [RKTestFactory client];
client.cachePolicy = RKRequestCachePolicyNone;
RKTestResponseLoader* loader = [RKTestResponseLoader responseLoader];
loader.timeout = 20;
@@ -666,7 +666,7 @@ - (void)testShouldSetAnEmptyContentBodyWhenQueryParamsIsAnEmptyDictionary {
}
- (void)testShouldPUTWithParams {
- RKClient* client = RKTestNewClient();
+ RKClient* client = [RKTestFactory client];
RKParams *params = [RKParams params];
[params setValue:@"ddss" forParam:@"username"];
[params setValue:@"aaaa@aa.com" forParam:@"email"];
@@ -718,7 +718,7 @@ - (void)testShouldOptionallySkipSSLValidation {
}
- (void)testShouldNotAddANonZeroContentLengthHeaderIfParamsIsSetAndThisIsAGETRequest {
- RKClient* client = RKTestNewClient();
+ RKClient* client = [RKTestFactory client];
client.disableCertificateValidation = YES;
NSURL* URL = [NSURL URLWithString:@"https://blakewatters.com/"];
RKTestResponseLoader* loader = [RKTestResponseLoader responseLoader];
@@ -731,7 +731,7 @@ - (void)testShouldNotAddANonZeroContentLengthHeaderIfParamsIsSetAndThisIsAGETReq
}
- (void)testShouldNotAddANonZeroContentLengthHeaderIfParamsIsSetAndThisIsAHEADRequest {
- RKClient* client = RKTestNewClient();
+ RKClient* client = [RKTestFactory client];
client.disableCertificateValidation = YES;
NSURL* URL = [NSURL URLWithString:@"https://blakewatters.com/"];
RKTestResponseLoader* loader = [RKTestResponseLoader responseLoader];
@@ -745,7 +745,7 @@ - (void)testShouldNotAddANonZeroContentLengthHeaderIfParamsIsSetAndThisIsAHEADRe
}
- (void)testShouldLetYouHandleResponsesWithABlock {
- RKURL *URL = [RKTestGetBaseURL() URLByAppendingResourcePath:@"/ping"];
+ RKURL *URL = [[RKTestFactory baseURL] URLByAppendingResourcePath:@"/ping"];
RKRequest *request = [RKRequest requestWithURL:URL];
RKTestResponseLoader *responseLoader = [RKTestResponseLoader responseLoader];
request.delegate = responseLoader;
@@ -759,7 +759,7 @@ - (void)testShouldLetYouHandleResponsesWithABlock {
}
- (void)testShouldLetYouHandleErrorsWithABlock {
- RKURL *URL = [RKTestGetBaseURL() URLByAppendingResourcePath:@"/fail"];
+ RKURL *URL = [[RKTestFactory baseURL] URLByAppendingResourcePath:@"/fail"];
RKRequest *request = [RKRequest requestWithURL:URL];
RKTestResponseLoader *responseLoader = [RKTestResponseLoader responseLoader];
request.delegate = responseLoader;
@@ -779,7 +779,7 @@ - (void)testShouldReturnACachePathWhenTheRequestIsUsingRKParams {
NSURL *URL = [NSURL URLWithString:@"http://restkit.org/"];
RKRequest *request = [RKRequest requestWithURL:URL];
request.params = params;
- NSString* baseURL = RKTestGetBaseURLString();
+ NSString* baseURL = [RKTestFactory baseURLString];
NSString* cacheDirForClient = [NSString stringWithFormat:@"RKClientRequestCache-%@",
[[NSURL URLWithString:baseURL] host]];
NSString* cachePath = [[RKDirectory cachesDirectory]
@@ -797,7 +797,7 @@ - (void)testShouldReturnNilForCachePathWhenTheRequestIsADELETE {
NSURL *URL = [NSURL URLWithString:@"http://restkit.org/"];
RKRequest *request = [RKRequest requestWithURL:URL];
request.method = RKRequestMethodDELETE;
- NSString* baseURL = RKTestGetBaseURLString();
+ NSString* baseURL = [RKTestFactory baseURLString];
NSString* cacheDirForClient = [NSString stringWithFormat:@"RKClientRequestCache-%@",
[[NSURL URLWithString:baseURL] host]];
NSString* cachePath = [[RKDirectory cachesDirectory]
@@ -820,7 +820,7 @@ - (void)testShouldBuildAProperAuthorizationHeaderForOAuth1 {
}
- (void)testOnDidLoadResponseBlockInvocation {
- RKURL *URL = [RKTestGetBaseURL() URLByAppendingResourcePath:@"/200"];
+ RKURL *URL = [[RKTestFactory baseURL] URLByAppendingResourcePath:@"/200"];
RKTestResponseLoader* loader = [RKTestResponseLoader responseLoader];
RKRequest *request = [RKRequest requestWithURL:URL];
__block RKResponse *blockResponse = nil;
@@ -834,7 +834,7 @@ - (void)testOnDidLoadResponseBlockInvocation {
}
- (void)testOnDidFailLoadWithErrorBlockInvocation {
- RKURL *URL = [RKTestGetBaseURL() URLByAppendingResourcePath:@"/503"];
+ RKURL *URL = [[RKTestFactory baseURL] URLByAppendingResourcePath:@"/503"];
RKRequest *request = [RKRequest requestWithURL:URL];
__block NSError *blockError = nil;
request.onDidFailLoadWithError = ^ (NSError *error) {
@@ -846,7 +846,7 @@ - (void)testOnDidFailLoadWithErrorBlockInvocation {
}
- (void)testShouldBuildAProperRequestWhenSettingBodyByMIMEType {
- RKClient* client = RKTestNewClient();
+ RKClient* client = [RKTestFactory client];
NSDictionary *bodyParams = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInt:10], @"number",
@"JSON String", @"string",
nil];
View
2  Tests/Logic/Network/RKResponseTest.m
@@ -260,7 +260,7 @@ - (void)testShouldNotCrashWhenParserReturnsNilWithoutAnError {
}
- (void)testLoadingNonUTF8Charset {
- RKClient* client = RKTestNewClient();
+ RKClient* client = [RKTestFactory client];
RKTestResponseLoader* loader = [RKTestResponseLoader responseLoader];
[client get:@"/encoding" delegate:loader];
[loader waitForResponse];
View
4 Tests/Logic/Network/RKURLTest.m
@@ -176,9 +176,9 @@ - (void)testShouldProperlyHandleLongURLParameterValues {
}
assertThatInteger([longResourcePath length], is(equalToInt(1050)));
- RKURL *URL = [RKURL URLWithBaseURLString:RKTestGetBaseURLString()
+ RKURL *URL = [RKURL URLWithBaseURLString:[RKTestFactory baseURLString]
resourcePath:longResourcePath];
- assertThat([URL absoluteString], is(equalTo([NSString stringWithFormat:@"%@/%@", RKTestGetBaseURLString(), longResourcePath])));
+ assertThat([URL absoluteString], is(equalTo([NSString stringWithFormat:@"%@/%@", [RKTestFactory baseURLString], longResourcePath])));
}
@end
View
66 Tests/Logic/ObjectMapping/RKObjectLoaderTest.m
@@ -108,7 +108,7 @@ - (RKObjectMappingProvider*)errorMappingProvider {
}
- (void)testShouldHandleTheErrorCaseAppropriately {
- RKObjectManager* objectManager = RKTestNewObjectManager();
+ RKObjectManager* objectManager = [RKTestFactory objectManager];
RKTestResponseLoader* responseLoader = [RKTestResponseLoader responseLoader];
RKObjectLoader* objectLoader = [objectManager loaderWithResourcePath:@"/errors.json"];
objectLoader.delegate = responseLoader;
@@ -132,7 +132,7 @@ - (void)testShouldHandleTheErrorCaseAppropriately {
}
- (void)testShouldNotCrashWhenLoadingAnErrorResponseWithAnUnmappableMIMEType {
- RKObjectManager* objectManager = RKTestNewObjectManager();
+ RKObjectManager* objectManager = [RKTestFactory objectManager];
RKTestResponseLoader* loader = [RKTestResponseLoader responseLoader];
[objectManager loadObjectsAtResourcePath:@"/404" delegate:loader];
[loader waitForResponse];
@@ -143,7 +143,7 @@ - (void)testShouldNotCrashWhenLoadingAnErrorResponseWithAnUnmappableMIMEType {
- (void)testShouldLoadAComplexUserObjectWithTargetObject {
RKTestComplexUser* user = [[RKTestComplexUser new] autorelease];
- RKObjectManager* objectManager = [RKObjectManager managerWithBaseURL:RKTestGetBaseURL()];
+ RKObjectManager* objectManager = [RKObjectManager managerWithBaseURL:[RKTestFactory baseURL]];
RKTestResponseLoader* responseLoader = [RKTestResponseLoader responseLoader];
RKObjectLoader* objectLoader = [objectManager loaderWithResourcePath:@"/JSON/ComplexNestedUser.json"];
objectLoader.delegate = responseLoader;
@@ -160,7 +160,7 @@ - (void)testShouldLoadAComplexUserObjectWithTargetObject {
}
- (void)testShouldLoadAComplexUserObjectWithoutTargetObject {
- RKObjectManager* objectManager = [RKObjectManager managerWithBaseURL:RKTestGetBaseURL()];
+ RKObjectManager* objectManager = [RKObjectManager managerWithBaseURL:[RKTestFactory baseURL]];
RKTestResponseLoader* responseLoader = [RKTestResponseLoader responseLoader];
RKObjectLoader* objectLoader = [objectManager loaderWithResourcePath:@"/JSON/ComplexNestedUser.json"];
objectLoader.delegate = responseLoader;
@@ -176,7 +176,7 @@ - (void)testShouldLoadAComplexUserObjectWithoutTargetObject {
}
- (void)testShouldLoadAComplexUserObjectUsingRegisteredKeyPath {
- RKObjectManager* objectManager = [RKObjectManager managerWithBaseURL:RKTestGetBaseURL()];
+ RKObjectManager* objectManager = [RKObjectManager managerWithBaseURL:[RKTestFactory baseURL]];
RKTestResponseLoader* responseLoader = [RKTestResponseLoader responseLoader];
RKObjectLoader* objectLoader = [objectManager loaderWithResourcePath:@"/JSON/ComplexNestedUser.json"];
objectLoader.delegate = responseLoader;
@@ -193,7 +193,7 @@ - (void)testShouldLoadAComplexUserObjectUsingRegisteredKeyPath {
#pragma mark - willSendWithObjectLoader:
- (void)testShouldInvokeWillSendWithObjectLoaderOnSend {
- RKObjectManager* objectManager = RKTestNewObjectManager();
+ RKObjectManager* objectManager = [RKTestFactory objectManager];
RKTestComplexUser* user = [[RKTestComplexUser new] autorelease];
id mockObject = [OCMockObject partialMockForObject:user];
@@ -210,7 +210,7 @@ - (void)testShouldInvokeWillSendWithObjectLoaderOnSend {
}
- (void)testShouldInvokeWillSendWithObjectLoaderOnSendAsynchronously {
- RKObjectManager* objectManager = [RKObjectManager managerWithBaseURL:RKTestGetBaseURL()];
+ RKObjectManager* objectManager = [RKObjectManager managerWithBaseURL:[RKTestFactory baseURL]];
[objectManager setMappingProvider:[self providerForComplexUser]];
RKTestComplexUser* user = [[RKTestComplexUser new] autorelease];
id mockObject = [OCMockObject partialMockForObject:user];
@@ -227,7 +227,7 @@ - (void)testShouldInvokeWillSendWithObjectLoaderOnSendAsynchronously {
}
- (void)testShouldInvokeWillSendWithObjectLoaderOnSendSynchronously {
- RKObjectManager* objectManager = [RKObjectManager managerWithBaseURL:RKTestGetBaseURL()];
+ RKObjectManager* objectManager = [RKObjectManager managerWithBaseURL:[RKTestFactory baseURL]];
[objectManager setMappingProvider:[self providerForComplexUser]];
RKTestComplexUser* user = [[RKTestComplexUser new] autorelease];
id mockObject = [OCMockObject partialMockForObject:user];
@@ -241,7 +241,7 @@ - (void)testShouldInvokeWillSendWithObjectLoaderOnSendSynchronously {
}
- (void)testShouldLoadResultsNestedAtAKeyPath {
- RKObjectManager* objectManager = RKTestNewObjectManager();
+ RKObjectManager* objectManager = [RKTestFactory objectManager];
RKObjectMapping* objectMapping = [RKObjectMapping mappingForClass:[RKObjectLoaderTestResultModel class]];
[objectMapping mapKeyPath:@"id" toAttribute:@"ID"];
[objectMapping mapKeyPath:@"ends_at" toAttribute:@"endsAt"];
@@ -259,7 +259,7 @@ - (void)testShouldLoadResultsNestedAtAKeyPath {
- (void)testShouldAllowMutationOfTheParsedDataInWillMapData {
RKTestResponseLoaderWithWillMapData* loader = (RKTestResponseLoaderWithWillMapData*)[RKTestResponseLoaderWithWillMapData responseLoader];
- RKObjectManager* manager = RKTestNewObjectManager();
+ RKObjectManager* manager = [RKTestFactory objectManager];
[manager loadObjectsAtResourcePath:@"/JSON/humans/1.json" delegate:loader];
[loader waitForResponse];
assertThat([loader.mappableData valueForKey:@"newKey"], is(equalTo(@"monkey!")));
@@ -270,7 +270,7 @@ - (void)testShouldAllowYouToPostAnObjectAndHandleAnEmpty204Response {
[mapping mapAttributes:@"firstname", @"lastname", @"email", nil];
RKObjectMapping* serializationMapping = [mapping inverseMapping];
- RKObjectManager* objectManager = RKTestNewObjectManager();
+ RKObjectManager* objectManager = [RKTestFactory objectManager];
[objectManager.router routeClass:[RKTestComplexUser class] toResourcePath:@"/204"];
[objectManager.mappingProvider setSerializationMapping:serializationMapping forClass:[RKTestComplexUser class]];
@@ -294,7 +294,7 @@ - (void)testShouldAllowYouToPOSTAnObjectAndMapBackNonNestedContent {
[mapping mapAttributes:@"firstname", @"lastname", @"email", nil];
RKObjectMapping* serializationMapping = [mapping inverseMapping];
- RKObjectManager* objectManager = RKTestNewObjectManager();
+ RKObjectManager* objectManager = [RKTestFactory objectManager];
[objectManager.router routeClass:[RKTestComplexUser class] toResourcePath:@"/notNestedUser"];
[objectManager.mappingProvider setSerializationMapping:serializationMapping forClass:[RKTestComplexUser class]];
@@ -321,7 +321,7 @@ - (void)testShouldMapContentWithoutAMIMEType {
[mapping mapAttributes:@"firstname", @"lastname", @"email", nil];
RKObjectMapping* serializationMapping = [mapping inverseMapping];
- RKObjectManager* objectManager = RKTestNewObjectManager();
+ RKObjectManager* objectManager = [RKTestFactory objectManager];
[[RKParserRegistry sharedRegistry] setParserClass:[RKJSONParserJSONKit class] forMIMEType:@"text/html"];
[objectManager.router routeClass:[RKTestComplexUser class] toResourcePath:@"/noMIME"];
[objectManager.mappingProvider setSerializationMapping:serializationMapping forClass:[RKTestComplexUser class]];
@@ -349,7 +349,7 @@ - (void)testShouldAllowYouToPOSTAnObjectOfOneTypeAndGetBackAnother {
RKObjectMapping* targetMapping = [RKObjectMapping mappingForClass:[RKObjectLoaderTestResultModel class]];
[targetMapping mapAttributes:@"ID", nil];
- RKObjectManager* objectManager = RKTestNewObjectManager();
+ RKObjectManager* objectManager = [RKTestFactory objectManager];
[objectManager.router routeClass:[RKTestComplexUser class] toResourcePath:@"/notNestedUser"];
[objectManager.mappingProvider setSerializationMapping:serializationMapping forClass:[RKTestComplexUser class]];
@@ -385,7 +385,7 @@ - (void)testShouldAllowYouToPOSTAnObjectOfOneTypeAndGetBackAnotherViaURLConfigur
RKObjectMapping* targetMapping = [RKObjectMapping mappingForClass:[RKObjectLoaderTestResultModel class]];
[targetMapping mapAttributes:@"ID", nil];
- RKObjectManager* objectManager = RKTestNewObjectManager();
+ RKObjectManager* objectManager = [RKTestFactory objectManager];
[objectManager.router routeClass:[RKTestComplexUser class] toResourcePath:@"/notNestedUser"];
[objectManager.mappingProvider setSerializationMapping:serializationMapping forClass:[RKTestComplexUser class]];
[objectManager.mappingProvider setObjectMapping:targetMapping forResourcePathPattern:@"/notNestedUser"];
@@ -419,7 +419,7 @@ - (void)testShouldAllowYouToPOSTAnObjectAndMapBackNonNestedContentViapostObject
[mapping mapAttributes:@"firstname", @"lastname", @"email", nil];
RKObjectMapping* serializationMapping = [mapping inverseMapping];
- RKObjectManager* objectManager = RKTestNewObjectManager();
+ RKObjectManager* objectManager = [RKTestFactory objectManager];
[objectManager.router routeClass:[RKTestComplexUser class] toResourcePath:@"/notNestedUser"];
[objectManager.mappingProvider setSerializationMapping:serializationMapping forClass:[RKTestComplexUser class]];
@@ -445,7 +445,7 @@ - (void)testShouldRespectTheRootKeyPathWhenConstructingATemporaryObjectMappingPr
[userMapping mapAttributes:@"firstname", nil];
RKTestComplexUser* user = [[RKTestComplexUser new] autorelease];
- RKObjectManager* objectManager = [RKObjectManager managerWithBaseURL:RKTestGetBaseURL()];
+ RKObjectManager* objectManager = [RKObjectManager managerWithBaseURL:[RKTestFactory baseURL]];
RKTestResponseLoader* responseLoader = [RKTestResponseLoader responseLoader];
RKObjectLoader* objectLoader = [objectManager loaderWithResourcePath:@"/JSON/ComplexNestedUser.json"];
@@ -466,7 +466,7 @@ - (void)testShouldDetermineObjectLoaderBasedOnResourcePathPatternWithExactMatch
[userMapping mapAttributes:@"firstname", nil];
RKTestComplexUser* user = [[RKTestComplexUser new] autorelease];
- RKObjectManager* objectManager = [RKObjectManager managerWithBaseURL:RKTestGetBaseURL()];
+ RKObjectManager* objectManager = [RKObjectManager managerWithBaseURL:[RKTestFactory baseURL]];
RKTestResponseLoader* responseLoader = [RKTestResponseLoader responseLoader];
RKObjectMappingProvider *mappingProvider = [RKObjectMappingProvider mappingProvider];
[mappingProvider setObjectMapping:userMapping forResourcePathPattern:@"/JSON/ComplexNestedUser.json"];
@@ -491,7 +491,7 @@ - (void)testShouldDetermineObjectLoaderBasedOnResourcePathPatternWithPartialMatc
[userMapping mapAttributes:@"firstname", nil];
RKTestComplexUser* user = [[RKTestComplexUser new] autorelease];
- RKObjectManager* objectManager = [RKObjectManager managerWithBaseURL:RKTestGetBaseURL()];
+ RKObjectManager* objectManager = [RKObjectManager managerWithBaseURL:[RKTestFactory baseURL]];
RKTestResponseLoader* responseLoader = [RKTestResponseLoader responseLoader];
RKObjectMappingProvider *mappingProvider = [RKObjectMappingProvider mappingProvider];
[mappingProvider setObjectMapping:userMapping forResourcePathPattern:@"/JSON/:name\\.json"];
@@ -511,7 +511,7 @@ - (void)testShouldDetermineObjectLoaderBasedOnResourcePathPatternWithPartialMatc
}
- (void)testShouldReturnSuccessWhenTheStatusCodeIs200AndTheResponseBodyIsEmpty {
- RKObjectManager* objectManager = RKTestNewObjectManager();
+ RKObjectManager* objectManager = [RKTestFactory objectManager];
RKTestComplexUser* user = [[RKTestComplexUser new] autorelease];
user.firstname = @"Blake";
@@ -533,7 +533,7 @@ - (void)testShouldReturnSuccessWhenTheStatusCodeIs200AndTheResponseBodyIsEmpty {
}
- (void)testShouldInvokeTheDelegateWithTheTargetObjectWhenTheStatusCodeIs200AndTheResponseBodyIsEmpty {
- RKObjectManager* objectManager = RKTestNewObjectManager();
+ RKObjectManager* objectManager = [RKTestFactory objectManager];
RKTestComplexUser* user = [[RKTestComplexUser new] autorelease];
user.firstname = @"Blake";
@@ -556,7 +556,7 @@ - (void)testShouldInvokeTheDelegateWithTheTargetObjectWhenTheStatusCodeIs200AndT
}
- (void)testShouldConsiderTheLoadOfEmptyObjectsWithoutAnyMappableAttributesAsSuccess {
- RKObjectManager* objectManager = RKTestNewObjectManager();
+ RKObjectManager* objectManager = [RKTestFactory objectManager];
RKObjectMapping* userMapping = [RKObjectMapping mappingForClass:[RKTestComplexUser class]];
[userMapping mapAttributes:@"firstname", nil];
@@ -570,7 +570,7 @@ - (void)testShouldConsiderTheLoadOfEmptyObjectsWithoutAnyMappableAttributesAsSuc
}
- (void)testShouldInvokeTheDelegateOnSuccessIfTheResponseIsAnEmptyArray {
- RKObjectManager* objectManager = RKTestNewObjectManager();
+ RKObjectManager* objectManager = [RKTestFactory objectManager];
RKTestResponseLoader* responseLoader = [RKTestResponseLoader responseLoader];
responseLoader.timeout = 20;
[objectManager loadObjectsAtResourcePath:@"/empty/array" delegate:responseLoader];
@@ -581,7 +581,7 @@ - (void)testShouldInvokeTheDelegateOnSuccessIfTheResponseIsAnEmptyArray {
}
- (void)testShouldInvokeTheDelegateOnSuccessIfTheResponseIsAnEmptyDictionary {
- RKObjectManager* objectManager = RKTestNewObjectManager();
+ RKObjectManager* objectManager = [RKTestFactory objectManager];
RKTestResponseLoader* responseLoader = [RKTestResponseLoader responseLoader];
responseLoader.timeout = 20;
[objectManager loadObjectsAtResourcePath:@"/empty/dictionary" delegate:responseLoader];
@@ -592,7 +592,7 @@ - (void)testShouldInvokeTheDelegateOnSuccessIfTheResponseIsAnEmptyDictionary {
}
- (void)testShouldInvokeTheDelegateOnSuccessIfTheResponseIsAnEmptyString {
- RKObjectManager* objectManager = RKTestNewObjectManager();
+ RKObjectManager* objectManager = [RKTestFactory objectManager];
RKTestResponseLoader* responseLoader = [RKTestResponseLoader responseLoader];
responseLoader.timeout = 20;
[objectManager loadObjectsAtResourcePath:@"/empty/string" delegate:responseLoader];
@@ -603,7 +603,7 @@ - (void)testShouldInvokeTheDelegateOnSuccessIfTheResponseIsAnEmptyString {
}
- (void)testShouldNotBlockNetworkOperationsWhileAwaitingObjectMapping {
- RKObjectManager* objectManager = RKTestNewObjectManager();
+ RKObjectManager* objectManager = [RKTestFactory objectManager];
objectManager.requestCache.storagePolicy = RKRequestCacheStoragePolicyDisabled;
objectManager.client.requestQueue.concurrentRequestsLimit = 1;
RKObjectMapping* userMapping = [RKObjectMapping mappingForClass:[RKTestComplexUser class]];
@@ -626,7 +626,7 @@ - (void)testShouldNotBlockNetworkOperationsWhileAwaitingObjectMapping {
#pragma mark - Block Tests
- (void)testInvocationOfDidLoadObjectBlock {
- RKObjectManager* objectManager = [RKObjectManager managerWithBaseURL:RKTestGetBaseURL()];
+ RKObjectManager* objectManager = [RKObjectManager managerWithBaseURL:[RKTestFactory baseURL]];
RKTestResponseLoader* responseLoader = [RKTestResponseLoader responseLoader];
RKObjectLoader* objectLoader = [objectManager loaderWithResourcePath:@"/JSON/ComplexNestedUser.json"];
objectLoader.delegate = responseLoader;
@@ -643,7 +643,7 @@ - (void)testInvocationOfDidLoadObjectBlock {
}
- (void)testInvocationOfDidLoadObjectBlockIsSingularObjectOfCorrectType {
- RKObjectManager* objectManager = [RKObjectManager managerWithBaseURL:RKTestGetBaseURL()];
+ RKObjectManager* objectManager = [RKObjectManager managerWithBaseURL:[RKTestFactory baseURL]];
RKTestResponseLoader* responseLoader = [RKTestResponseLoader responseLoader];
RKObjectLoader* objectLoader = [objectManager loaderWithResourcePath:@"/JSON/ComplexNestedUser.json"];
objectLoader.delegate = responseLoader;
@@ -660,7 +660,7 @@ - (void)testInvocationOfDidLoadObjectBlockIsSingularObjectOfCorrectType {
}
- (void)testInvocationOfDidLoadObjectsBlock {
- RKObjectManager* objectManager = [RKObjectManager managerWithBaseURL:RKTestGetBaseURL()];
+ RKObjectManager* objectManager = [RKObjectManager managerWithBaseURL:[RKTestFactory baseURL]];
RKTestResponseLoader* responseLoader = [RKTestResponseLoader responseLoader];
RKObjectLoader* objectLoader = [objectManager loaderWithResourcePath:@"/JSON/ComplexNestedUser.json"];
objectLoader.delegate = responseLoader;
@@ -677,7 +677,7 @@ - (void)testInvocationOfDidLoadObjectsBlock {
}
- (void)testInvocationOfDidLoadObjectsBlocksIsCollectionOfObjects {
- RKObjectManager* objectManager = [RKObjectManager managerWithBaseURL:RKTestGetBaseURL()];
+ RKObjectManager* objectManager = [RKObjectManager managerWithBaseURL:[RKTestFactory baseURL]];
RKTestResponseLoader* responseLoader = [RKTestResponseLoader responseLoader];
RKObjectLoader* objectLoader = [objectManager loaderWithResourcePath:@"/JSON/ComplexNestedUser.json"];
objectLoader.delegate = responseLoader;
@@ -697,7 +697,7 @@ - (void)testInvocationOfDidLoadObjectsBlocksIsCollectionOfObjects {
}
- (void)testInvocationOfDidLoadObjectsDictionaryBlock {
- RKObjectManager* objectManager = [RKObjectManager managerWithBaseURL:RKTestGetBaseURL()];
+ RKObjectManager* objectManager = [RKObjectManager managerWithBaseURL:[RKTestFactory baseURL]];
RKTestResponseLoader* responseLoader = [RKTestResponseLoader responseLoader];
RKObjectLoader* objectLoader = [objectManager loaderWithResourcePath:@"/JSON/ComplexNestedUser.json"];
objectLoader.delegate = responseLoader;
@@ -714,7 +714,7 @@ - (void)testInvocationOfDidLoadObjectsDictionaryBlock {
}
- (void)testInvocationOfDidLoadObjectsDictionaryBlocksIsDictionaryOfObjects {
- RKObjectManager* objectManager = [RKObjectManager managerWithBaseURL:RKTestGetBaseURL()];
+ RKObjectManager* objectManager = [RKObjectManager managerWithBaseURL:[RKTestFactory baseURL]];
RKTestResponseLoader* responseLoader = [RKTestResponseLoader responseLoader];
RKObjectLoader* objectLoader = [objectManager loaderWithResourcePath:@"/JSON/ComplexNestedUser.json"];
objectLoader.delegate = responseLoader;
@@ -745,7 +745,7 @@ - (void)testInvocationOfOnDidFailWithError {
}
- (void)testShouldNotAssertDuringObjectMappingOnSynchronousRequest {
- RKObjectManager* objectManager = RKTestNewObjectManager();
+ RKObjectManager* objectManager = [RKTestFactory objectManager];
RKObjectMapping* userMapping = [RKObjectMapping mappingForClass:[RKTestComplexUser class]];
userMapping.rootKeyPath = @"data.STUser";
View
20 Tests/Logic/ObjectMapping/RKObjectManagerTest.m
@@ -37,7 +37,7 @@ @interface RKObjectManagerTest : RKTestCase {
@implementation RKObjectManagerTest
- (void)setUp {
- _objectManager = RKTestNewObjectManager();
+ _objectManager = [RKTestFactory objectManager];
_objectManager.objectStore = [RKManagedObjectStore objectStoreWithStoreFilename:@"RKTests.sqlite"];
[RKObjectManager setSharedManager:_objectManager];
[_objectManager.objectStore deletePersistantStore];
@@ -177,7 +177,7 @@ - (void)testShouldHandleConnectionFailures {
}
- (void)testShouldPOSTAnObject {
- RKObjectManager* manager = RKTestNewObjectManager();
+ RKObjectManager* manager = [RKTestFactory objectManager];
RKObjectRouter* router = [[RKObjectRouter new] autorelease];
[router routeClass:[RKObjectMapperTestModel class] toResourcePath:@"/humans" forMethod:RKRequestMethodPOST];
@@ -203,7 +203,7 @@ - (void)testShouldPOSTAnObject {
}
- (void)testShouldNotSetAContentBodyOnAGET {
- RKObjectManager* objectManager = RKTestNewObjectManager();
+ RKObjectManager* objectManager = [RKTestFactory objectManager];
[objectManager.router routeClass:[RKObjectMapperTestModel class] toResourcePath:@"/humans/1"];
RKObjectMapping* mapping = [RKObjectMapping mappingForClass:[RKObjectMapperTestModel class]];
@@ -225,7 +225,7 @@ - (void)testShouldNotSetAContentBodyOnAGET {
}
- (void)testShouldNotSetAContentBodyOnADELETE {
- RKObjectManager* objectManager = RKTestNewObjectManager();
+ RKObjectManager* objectManager = [RKTestFactory objectManager];
[objectManager.router routeClass:[RKObjectMapperTestModel class] toResourcePath:@"/humans/1"];
RKObjectMapping* mapping = [RKObjectMapping mappingForClass:[RKObjectMapperTestModel class]];
@@ -249,7 +249,7 @@ - (void)testShouldNotSetAContentBodyOnADELETE {
#pragma mark - Block Helpers
- (void)testShouldLetYouLoadObjectsWithABlock {
- RKObjectManager* objectManager = RKTestNewObjectManager();
+ RKObjectManager* objectManager = [RKTestFactory objectManager];
RKObjectMapping* mapping = [RKObjectMapping mappingForClass:[RKObjectMapperTestModel class]];
[mapping mapAttributes:@"name", @"age", nil];
[objectManager.mappingProvider registerMapping:mapping withRootKeyPath:@"human"];
@@ -265,7 +265,7 @@ - (void)testShouldLetYouLoadObjectsWithABlock {
}
- (void)testShouldAllowYouToOverrideTheRoutedResourcePath {
- RKObjectManager* objectManager = RKTestNewObjectManager();
+ RKObjectManager* objectManager = [RKTestFactory objectManager];
[objectManager.router routeClass:[RKObjectMapperTestModel class] toResourcePath:@"/humans/2"];
RKObjectMapping* mapping = [RKObjectMapping mappingForClass:[RKObjectMapperTestModel class]];
[mapping mapAttributes:@"name", @"age", nil];
@@ -284,7 +284,7 @@ - (void)testShouldAllowYouToOverrideTheRoutedResourcePath {