@@ -3,15 +3,7 @@ import Nimble
3
3
4
4
@testable import WordPress
5
5
6
- /// This test stuite is clashing with other tests
7
- /// Specifically:
8
- /// - [BlogJetpackTest testJetpackSetupDoesntReplaceDotcomAccount]
9
- /// - CommentServiceTests.testFailingFetchCommentLikesShouldCallFailureBlock()
10
- ///
11
- /// We weren't able to figure out why but it seems a race condition + Core data
12
- /// For now, renaming the suite to change the execution order solves the issue.
13
- class ZBlogDashboardServiceTests : XCTestCase {
14
- private var contextManager : ContextManagerMock !
6
+ class BlogDashboardServiceTests : CoreDataTestCase {
15
7
private var context : NSManagedObjectContext !
16
8
17
9
private var service : BlogDashboardService !
@@ -26,7 +18,6 @@ class ZBlogDashboardServiceTests: XCTestCase {
26
18
27
19
remoteServiceMock = DashboardServiceRemoteMock ( )
28
20
persistenceMock = BlogDashboardPersistenceMock ( )
29
- contextManager = ContextManagerMock ( )
30
21
context = contextManager. newDerivedContext ( )
31
22
postsParserMock = BlogDashboardPostsParserMock ( managedObjectContext: context)
32
23
service = BlogDashboardService ( managedObjectContext: context, remoteService: remoteServiceMock, persistence: persistenceMock, postsParser: postsParserMock)
@@ -35,7 +26,6 @@ class ZBlogDashboardServiceTests: XCTestCase {
35
26
override func tearDown( ) {
36
27
super. tearDown ( )
37
28
context = nil
38
- contextManager = nil
39
29
}
40
30
41
31
func testCallServiceWithCorrectIDAndCards( ) {
@@ -260,7 +250,7 @@ class ZBlogDashboardServiceTests: XCTestCase {
260
250
}
261
251
262
252
func dictionary( from file: String ) -> NSDictionary ? {
263
- let fileURL : URL = Bundle ( for: ZBlogDashboardServiceTests . self) . url ( forResource: file, withExtension: nil ) !
253
+ let fileURL : URL = Bundle ( for: BlogDashboardServiceTests . self) . url ( forResource: file, withExtension: nil ) !
264
254
let data : Data = try ! Data ( contentsOf: fileURL)
265
255
return try ? JSONSerialization . jsonObject ( with: data, options: [ ] ) as? NSDictionary
266
256
}
@@ -295,7 +285,7 @@ class DashboardServiceRemoteMock: DashboardServiceRemote {
295
285
didCallWithBlogID = blogID
296
286
didRequestCards = cards
297
287
298
- if let fileURL: URL = Bundle ( for: ZBlogDashboardServiceTests . self) . url ( forResource: respondWith. rawValue, withExtension: nil ) ,
288
+ if let fileURL: URL = Bundle ( for: BlogDashboardServiceTests . self) . url ( forResource: respondWith. rawValue, withExtension: nil ) ,
299
289
let data: Data = try ? Data ( contentsOf: fileURL) ,
300
290
let jsonObject = try ? JSONSerialization . jsonObject ( with: data, options: [ ] ) as AnyObject {
301
291
success ( jsonObject as! NSDictionary )
0 commit comments