Skip to content
This repository
Browse code

CTCoreMessage.htmlBody now behaves like .body

It calls fetchBodyStructure if myFields or myParsedMIME is null, just like .body does. Two new tests added; the change to htmlBody is required to get them both to pass.
commit 1934f9cd518d66eab9163d5eab3dfb08d592873c 1 parent fc5c8a3
Scott Nonnenberg authored December 21, 2012
3  Source/CTCoreMessage.m
@@ -177,6 +177,9 @@ - (BOOL)hasHtmlBody {
177 177
 }
178 178
 
179 179
 - (NSString *)htmlBody {
  180
+    if (myFields == NULL || myParsedMIME == nil) {
  181
+        [self fetchBodyStructure];
  182
+    }
180 183
     NSMutableString *result = [NSMutableString string];
181 184
     [self _buildUpHtmlBodyText:myParsedMIME result:result];
182 185
     return result;
10  Tests/CTCoreMessageTests.m
@@ -47,6 +47,16 @@ - (void)tearDown {
47 47
 	[myRealMsg release];
48 48
 }
49 49
 
  50
+- (void)testBody {
  51
+    STAssertTrue([[myRealMsg body] rangeOfString:@"Kiwi-dev mailing list"].location != NSNotFound, @"Expect to pull out the right text");
  52
+    NSLog(@"Body is %@", [myRealMsg body]);
  53
+}
  54
+
  55
+- (void)testHtmlBody {
  56
+    STAssertTrue([[myRealMsg htmlBody] rangeOfString:@"CTCoreMessage no longer depends"].location != NSNotFound, @"Expect to pull out the right text");
  57
+    NSLog(@"Html body is %@", [myRealMsg htmlBody]);
  58
+}
  59
+
50 60
 - (void)testBasicSubject {
51 61
 	[myMsg setSubject:@"Test value1!"];
52 62
 	STAssertEqualObjects(@"Test value1!", [myMsg subject], @"Basic set and get of subject failed.");

0 notes on commit 1934f9c

Please sign in to comment.
Something went wrong with that request. Please try again.