Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 61 lines (43 sloc) 1.243 kb
373a0c07 » hartbit
2012-03-05 Added a beSubclassOfClass matcher for matching Class ids
1 //
2 // Licensed under the terms in License.txt
3 //
4 // Copyright 2010 Allen Ding. All rights reserved.
5 //
6
7 #import "KWBeSubclassOfClassMatcher.h"
8 #import "KWFormatter.h"
9
10 @interface KWBeSubclassOfClassMatcher()
11
12 #pragma mark -
13 #pragma mark Properties
14
15 @property (nonatomic, readwrite, assign) Class targetClass;
16
17 @end
18
19 @implementation KWBeSubclassOfClassMatcher
20
21 #pragma mark -
22 #pragma mark Properties
23
24 @synthesize targetClass;
25
26 #pragma mark -
27 #pragma mark Getting Matcher Strings
28
29 + (NSArray *)matcherStrings {
30 return [NSArray arrayWithObject:@"beSubclassOfClass:"];
31 }
32
33 #pragma mark -
34 #pragma mark Matching
35
36 - (BOOL)evaluate {
37 return [self.subject isSubclassOfClass:self.targetClass];
38 }
39
40 #pragma mark -
41 #pragma mark Getting Failure Messages
42
43 - (NSString *)failureMessageForShould {
44 return [NSString stringWithFormat:@"expected subject to be subclass of %@",
45 NSStringFromClass(self.targetClass)];
46 }
47
48 - (NSString *)description
49 {
50 return [NSString stringWithFormat:@"be member of %@",
51 NSStringFromClass(self.targetClass)];
52 }
53
54 #pragma mark -
55 #pragma mark Configuring Matchers
56
57 - (void)beSubclassOfClass:(Class)aClass {
58 self.targetClass = aClass;
59 }
60
61 @end
Something went wrong with that request. Please try again.