forked from kiwi-bdd/Kiwi
-
Notifications
You must be signed in to change notification settings - Fork 55
/
KWBeKindOfClassMatcherTest.m
50 lines (39 loc) · 1.51 KB
/
KWBeKindOfClassMatcherTest.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
49
50
//
// 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
@interface KWBeKindOfClassMatcherTest : SenTestCase
@end
@implementation KWBeKindOfClassMatcherTest
- (void)testItShouldHaveTheRightMatcherStrings {
NSArray *matcherStrings = [KWBeKindOfClassMatcher matcherStrings];
NSArray *expectedStrings = @[@"beKindOfClass:"];
STAssertEqualObjects([matcherStrings sortedArrayUsingSelector:@selector(compare:)],
[expectedStrings sortedArrayUsingSelector:@selector(compare:)],
@"expected specific matcher strings");
}
- (void)testItShouldMatchKindOfClass {
id subject = [Cruiser cruiser];
id matcher = [KWBeKindOfClassMatcher matcherWithSubject:subject];
[matcher beKindOfClass:[SpaceShip class]];
STAssertTrue([matcher evaluate], @"expected positive match");
}
- (void)testItShouldNotMatchNonKindOfClass {
id subject = [Cruiser cruiser];
id matcher = [KWBeKindOfClassMatcher matcherWithSubject:subject];
[matcher beKindOfClass:[Fighter class]];
STAssertFalse([matcher evaluate], @"expected negative match");
}
- (void)testItShouldHaveHumanReadableDescription
{
id matcher = [KWBeKindOfClassMatcher matcherWithSubject:nil];
[matcher beKindOfClass:[Fighter class]];
STAssertEqualObjects(@"be kind of Fighter", [matcher description], @"description should match");
}
@end
#endif // #if KW_TESTS_ENABLED