This repository has been archived by the owner on Mar 29, 2018. It is now read-only.
forked from kiwi-bdd/Kiwi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
KWBlockRaiseMatcherTest.m
48 lines (38 loc) · 1.63 KB
/
KWBlockRaiseMatcherTest.m
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//
// Licensed under the terms in License.txt
//
// Copyright 2010 Allen Ding. All rights reserved.
//
#import "Kiwi.h"
#import "KiwiTestConfiguration.h"
#import "TestClasses.h"
#if KW_TESTS_ENABLED && KW_BLOCKS_ENABLED
@interface KWBlockRaiseMatcherTest : SenTestCase
@end
@implementation KWBlockRaiseMatcherTest
- (void)testItShouldHaveTheRightMatcherStrings {
NSArray *matcherStrings = [KWBlockRaiseMatcher matcherStrings];
NSArray *expectedStrings = [NSArray arrayWithObjects:@"raise",
@"raiseWithName:",
@"raiseWithReason:",
@"raiseWithName:reason:", nil];
STAssertEqualObjects([matcherStrings sortedArrayUsingSelector:@selector(compare:)],
[expectedStrings sortedArrayUsingSelector:@selector(compare:)],
@"expected specific matcher strings");
}
- (void)testItShouldMatchForRaisingBlocks {
id cruiser = [Cruiser cruiser];
id subject = [KWBlock blockWithBlock:^{ [cruiser raise]; }];
id matcher = [KWBlockRaiseMatcher matcherWithSubject:subject];
[matcher raise];
STAssertTrue([matcher evaluate], @"expected positive match");
}
- (void)testItShouldNotMatchForNonRaisingBlocks {
id cruiser = [Cruiser cruiser];
id subject = [KWBlock blockWithBlock:^{ [cruiser raiseShields]; }];
id matcher = [KWBlockRaiseMatcher matcherWithSubject:subject];
[matcher raise];
STAssertFalse([matcher evaluate], @"expected negative match");
}
@end
#endif // #if KW_TESTS_ENABLED && KW_BLOCKS_ENABLED