Skip to content

Commit 1ce382d

Browse files
committed
autoreleasepool for AF specs
1 parent c15e95e commit 1ce382d

3 files changed

Lines changed: 15 additions & 7 deletions

File tree

Cartfile.private

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Optional integrations
22

3-
github "Alamofire/Alamofire" ~> 4.0
3+
github "Alamofire/Alamofire"
44
# github "ReactiveCocoa/ReactiveCocoa" "master" # add to Cartfile if/when it has tests
55

66
# Testing
77

8-
github "Quick/Quick"
8+
github "pcantrell/Quick" "around-each"
99
github "Quick/Nimble"
1010
github "pcantrell/Nocilla" "siesta" # fork adds delay() / go(), nullability annotations

Cartfile.resolved

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
github "Alamofire/Alamofire" "4.7.2"
2-
github "Quick/Nimble" "v7.1.2"
3-
github "Quick/Quick" "v1.3.0"
1+
github "Alamofire/Alamofire" "4.7.3"
2+
github "Quick/Nimble" "v7.1.3"
43
github "pcantrell/Nocilla" "bd7ec7caa0576f08c00bbbf993a9204f93be16e3"
4+
github "pcantrell/Quick" "30b8c3f5f8b8b9eda6b6e75d1d8bcdef56908997"

Tests/Functional/ResourceSpecBase.swift

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@ class ResourceSpecBase: SiestaSpec
120120
//
121121
// NB: This must come _after_ the specVars above, which use afterEach to clear the service and resource.
122122

123+
aroundEach
124+
{
125+
example in
126+
autoreleasepool { example() } // Alamofire relies on autorelease, so each spec needs its own pool for leak checking
127+
}
128+
123129
afterEach
124130
{
125131
awaitObserverCleanup()
@@ -134,8 +140,10 @@ class ResourceSpecBase: SiestaSpec
134140

135141
// Run the actual specs
136142

137-
context("") // Separate context for service and resource above, so they’re cleaned up before leak check below
138-
{ resourceSpec(service, resource) }
143+
context("") // Make specVars above run in a separate context so their afterEach cleans up _before_ the leak check
144+
{
145+
resourceSpec(service, resource)
146+
}
139147
}
140148

141149
var baseURL: String

0 commit comments

Comments
 (0)