-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathSBCouchDesignDocumentTest.m
More file actions
34 lines (23 loc) · 1019 Bytes
/
SBCouchDesignDocumentTest.m
File metadata and controls
34 lines (23 loc) · 1019 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#import <SenTestingKit/SenTestingKit.h>
#import "SBCouchDesignDocument.h"
#import "SBCouchView.h"
#import "SBCouchResponse.h"
#import "CouchObjC.h"
static NSString *MAP_FUNCTION = @"function(doc) { if(doc.name == 'Frank'){ emit('Number of Franks', 1);}}";
static NSString *REDUCE_FUNCTION = @"function(k, v, rereduce) { return sum(v);}";
@interface SBCouchDesignDocumentTest : SenTestCase {
}
@end
@implementation SBCouchDesignDocumentTest
-(void)testDesignDocumentCreation{
SBCouchDesignDocument *designDocument = [[SBCouchDesignDocument alloc] init];
SBCouchView *view = [[SBCouchView alloc] initWithName:@"franks" andMap:MAP_FUNCTION andReduce:REDUCE_FUNCTION];
STAssertNotNil(designDocument, nil);
STAssertNotNil(view, nil);
STAssertTrue([view.map isEqualToString:MAP_FUNCTION], nil);
[designDocument addView:view withName:@"franks"];
STIGDebug(@"description %@", designDocument);
[designDocument release];
[view release];
}
@end