File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change 17
17
#import " PFConfig.h"
18
18
#import " PFConfigController.h"
19
19
#import " PFTestCase.h"
20
+ #import " PFPersistenceController.h"
21
+ #import " PFPersistenceGroup.h"
22
+
23
+ @protocol ConfigControllerDataSource <PFCommandRunnerProvider, PFPersistenceControllerProvider>
24
+
25
+ @end
20
26
21
27
@interface ConfigControllerTests : PFTestCase
22
28
23
29
@end
24
30
25
31
@implementation ConfigControllerTests
26
32
33
+ // /--------------------------------------
34
+ #pragma mark - Helpers
35
+ // /--------------------------------------
36
+
37
+ - (PFPersistenceController *)mockedPersistenceController {
38
+ id controller = PFStrictClassMock ([PFPersistenceController class ]);
39
+ id group = PFProtocolMock (@protocol (PFPersistenceGroup));
40
+ OCMStub ([controller getPersistenceGroupAsync ]).andReturn ([BFTask taskWithResult: group]);
41
+ return controller;
42
+ }
43
+
27
44
// /--------------------------------------
28
45
#pragma mark - Tests
29
46
// /--------------------------------------
@@ -50,8 +67,9 @@ - (void)testFetch {
50
67
forCommandsPassingTest: ^BOOL (id obj) {
51
68
return YES ;
52
69
}];
53
- id dataSource = PFStrictProtocolMock (@protocol (PFCommandRunnerProvider ));
70
+ id dataSource = PFStrictProtocolMock (@protocol (ConfigControllerDataSource ));
54
71
OCMStub ([dataSource commandRunner ]).andReturn (commandRunner);
72
+ OCMStub ([dataSource persistenceController ]).andReturn ([self mockedPersistenceController ]);
55
73
56
74
PFConfigController *configController = [[PFConfigController alloc ] initWithDataSource: dataSource];
57
75
You can’t perform that action at this time.
0 commit comments