forked from cedarbdd/cedar
/
CDRXCTestSuiteSpec.mm
70 lines (55 loc) · 2.21 KB
/
CDRXCTestSuiteSpec.mm
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#import "Cedar.h"
#import "CDRXCTestSuite.h"
#import "CDRReportDispatcher.h"
#import "CDRXCTestSupport.h"
#import "TestReporter.h"
#if !__has_feature(objc_arc)
#error This class must be compiled with ARC.
#endif
using namespace Cedar::Matchers;
using namespace Cedar::Doubles;
SPEC_BEGIN(CDRXCTestSuiteSpec)
describe(@"CDRXCTestSuite", ^{
__block id subject;
__block TestReporter *reporter;
__block CDRReportDispatcher *dispatcher;
beforeEach(^{
reporter = [TestReporter new];
dispatcher = [[CDRReportDispatcher alloc] initWithReporters:@[reporter]];
CDRSpec *simulatedSpec = [[NSClassFromString(@"CDRXCSimulatedTestSuiteSpec") alloc] init];
[simulatedSpec defineBehaviors];
subject = [simulatedSpec testSuiteWithRandomSeed:0 dispatcher:dispatcher];
[subject performTest:nil];
});
it(@"should report that each parent example group has started and ended", ^{
reporter.startedExampleGroups.count should equal(4);
reporter.finishedExampleGroups.count should equal(4);
});
it(@"should report that pending examples have started and ended", ^{
NSPredicate *pendingPredicate = [NSPredicate predicateWithBlock:^BOOL(CDRExample *example, NSDictionary *_) {
return example.state == CDRExampleStatePending;
}];
[reporter.startedExamples filteredArrayUsingPredicate:pendingPredicate].count should equal(2);
[reporter.finishedExamples filteredArrayUsingPredicate:pendingPredicate].count should equal(2);
});
});
SPEC_END
SPEC_BEGIN(CDRXCSimulatedTestSuiteSpec)
describe(@"CDRXCSimulatedTestSuite", ^{
describe(@"with nested groups", ^{
describe(@"lots of nested groups", ^{
describe(@"no really, lots of nested groups", ^{
xit(@"should report pending examples before the first test to run", ^{
1 should equal(2);
});
it(@"should start and finish each example group", ^{
// nothing to see here
});
xit(@"should report pending examples after the last test to run", ^{
1 should equal(2);
});
});
});
});
});
SPEC_END