aboutsummaryrefslogtreecommitdiffstats
path: root/Frameworks/PostgresKit/Tests/PGPostgresResultTests.m
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2013-05-21 21:57:57 +0000
committerstuconnolly <stuart02@gmail.com>2013-05-21 21:57:57 +0000
commit9432986de1d25527b133715ab12a8dffc2c5f6b6 (patch)
tree1297927fb1124cf5ee96c6577db504f0386ff489 /Frameworks/PostgresKit/Tests/PGPostgresResultTests.m
parent4631fedc1bd61dcf7a51970ffdbf4a62d3319c8a (diff)
downloadsequelpro-9432986de1d25527b133715ab12a8dffc2c5f6b6.tar.gz
sequelpro-9432986de1d25527b133715ab12a8dffc2c5f6b6.tar.bz2
sequelpro-9432986de1d25527b133715ab12a8dffc2c5f6b6.zip
PostgresKit: Add a common integration test case base.
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];
}