Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

65 lines (55 sloc) 2.918 kb
//
// GBCommentsProcessor-TextItemsTesting.m
// appledoc
//
// Created by Tomaz Kragelj on 30.8.10.
// Copyright (C) 2010 Gentle Bytes. All rights reserved.
//
#import "GBComment.h"
#import "GBCommentsProcessor.h"
@interface GBCommentsProcessorTextItemsTesting : GBObjectsAssertor
@end
#pragma mark -
@implementation GBCommentsProcessorTextItemsTesting
- (void)testProcessCommentWithStore_textItems_shouldGenerateSingleParagraph {
// setup
GBCommentsProcessor *processor = [GBCommentsProcessor processorWithSettingsProvider:[GBTestObjectsRegistry mockSettingsProvider]];
GBComment *comment = [GBComment commentWithStringValue:@"Paragraph"];
// execute
[processor processComment:comment withStore:[GBTestObjectsRegistry store]];
// verify
assertThatInteger([comment.paragraphs count], equalToInteger(1));
[self assertParagraph:[comment.paragraphs objectAtIndex:0] containsItems:[GBParagraphTextItem class], @"Paragraph", nil];
}
- (void)testProcessCommentWithStore_textItems_shouldGenerateAllParagraphs {
// setup
GBCommentsProcessor *processor = [GBCommentsProcessor processorWithSettingsProvider:[GBTestObjectsRegistry mockSettingsProvider]];
GBComment *comment = [GBComment commentWithStringValue:@"Paragraph1\n\nParagraph2"];
// execute
[processor processComment:comment withStore:[GBTestObjectsRegistry store]];
// verify
assertThatInteger([[comment paragraphs] count], equalToInteger(2));
[self assertParagraph:[[comment paragraphs] objectAtIndex:0] containsItems:[GBParagraphTextItem class], @"Paragraph1", nil];
[self assertParagraph:[[comment paragraphs] objectAtIndex:1] containsItems:[GBParagraphTextItem class], @"Paragraph2", nil];
}
- (void)testProcessCommentWithStore_textItems_shouldCombineAllParagraphLinesIntoOne {
// setup
GBCommentsProcessor *processor = [GBCommentsProcessor processorWithSettingsProvider:[GBTestObjectsRegistry mockSettingsProvider]];
GBComment *comment = [GBComment commentWithStringValue:@"First line\nSecond line"];
// execute
[processor processComment:comment withStore:[GBTestObjectsRegistry store]];
// verify
assertThatInteger([[comment paragraphs] count], equalToInteger(1));
[self assertParagraph:[comment.paragraphs objectAtIndex:0] containsItems:[GBParagraphTextItem class], @"First line Second line", nil];
}
- (void)testProcessCommentWithStore_textItems_shouldTrimAllParagraphSpaces {
// setup
GBCommentsProcessor *processor = [GBCommentsProcessor processorWithSettingsProvider:[GBTestObjectsRegistry mockSettingsProvider]];
GBComment *comment = [GBComment commentWithStringValue:@" First line Second line "];
// execute
[processor processComment:comment withStore:[GBTestObjectsRegistry store]];
// verify
assertThatInteger([[comment paragraphs] count], equalToInteger(1));
[self assertParagraph:[comment.paragraphs objectAtIndex:0] containsItems:[GBParagraphTextItem class], @"First line Second line", nil];
}
@end
Jump to Line
Something went wrong with that request. Please try again.