aboutsummaryrefslogtreecommitdiffstats
path: root/Frameworks/PostgresKit/Tests/PGPostgresResultTests.m
diff options
context:
space:
mode:
Diffstat (limited to 'Frameworks/PostgresKit/Tests/PGPostgresResultTests.m')
-rw-r--r--Frameworks/PostgresKit/Tests/PGPostgresResultTests.m49
1 files changed, 3 insertions, 46 deletions
diff --git a/Frameworks/PostgresKit/Tests/PGPostgresResultTests.m b/Frameworks/PostgresKit/Tests/PGPostgresResultTests.m
index 046b4ce6..5553cd75 100644
--- a/Frameworks/PostgresKit/Tests/PGPostgresResultTests.m
+++ b/Frameworks/PostgresKit/Tests/PGPostgresResultTests.m
@@ -30,19 +30,6 @@
#import "PGPostgresResultTests.h"
-static NSString *PGTestDatabaseHost = @"localhost";
-static NSString *PGTestDatabaseUser = @"pgkit_test";
-static NSString *PGTestDatabaseName = @"pgkit_test";
-static NSString *PGTestDatabasePassword = @"pgkit";
-
-static NSUInteger PGTestDatabasePort = 5432;
-
-@interface PGPostgresResultTests ()
-
-- (void)_establishConnection;
-
-@end
-
@implementation PGPostgresResultTests
#pragma mark -
@@ -50,11 +37,9 @@ static NSUInteger PGTestDatabasePort = 5432;
- (void)setUp
{
- _connection = [[PGPostgresConnection alloc] init];
+ [super setUp];
- [self _establishConnection];
-
- _result = [_connection execute:@"SELECT * FROM \"data_types\""];
+ _result = [[self connection] execute:@"SELECT * FROM \"data_types\""];
}
#pragma mark -
@@ -81,38 +66,10 @@ static NSUInteger PGTestDatabasePort = 5432;
}
#pragma mark -
-#pragma mark Private API
-
-- (void)_establishConnection
-{
- [_connection setHost:PGTestDatabaseHost];
- [_connection setUser:PGTestDatabaseUser];
- [_connection setPort:PGTestDatabasePort];
- [_connection setDatabase:PGTestDatabaseName];
- [_connection setPassword:PGTestDatabasePassword];
-
- if (![_connection connect]) {
- STFail(@"Request to establish connection to local database failed.");
-
- exit(1);
- }
-
- do {
- sleep(0.1);
- }
- while (![_connection isConnected]);
-}
-
-#pragma mark -
- (void)dealloc
-{
- if (_connection && [_connection isConnected]) {
- [_connection disconnect];
- }
-
+{
if (_result) [_result release], _result = nil;
- if (_connection) [_connection release], _connection = nil;
[super dealloc];
}