@@ -145,6 +145,74 @@ class QuickELoggerObjCIntegrationSpec: QuickSpec {
145
145
}
146
146
}
147
147
}
148
+
149
+ describe ( " writing to other directories besides the Documents directory " ) {
150
+ describe ( " tmp " ) {
151
+ beforeEach {
152
+ subject = QuickELoggerObjC ( directory: . temp)
153
+
154
+ subject. log ( message: " This is temporary and will get deleted frequently " , type: . info)
155
+ }
156
+
157
+ it ( " writes the log file to the temp directory " ) {
158
+ let logMessages = getLogMessages ( filename: " QuickELogger " , directory: . temp)
159
+
160
+ expect ( logMessages. count) . to ( equal ( 1 ) )
161
+
162
+ let logMessage = logMessages. first!
163
+
164
+ expect ( logMessage. id) . toNot ( beNil ( ) )
165
+ expect ( logMessage. timeStamp) . toNot ( beNil ( ) )
166
+
167
+ expect ( logMessage. type) . to ( equal ( . info) )
168
+ expect ( logMessage. message) . to ( equal ( " This is temporary and will get deleted frequently " ) )
169
+ }
170
+ }
171
+
172
+ describe ( " Caches " ) {
173
+ beforeEach {
174
+ subject = QuickELoggerObjC ( directory: . caches)
175
+
176
+ subject. log ( message: " This can be deleted unexpectedly " , type: . info)
177
+ }
178
+
179
+ it ( " writes the log file to the caches directory " ) {
180
+ let logMessages = getLogMessages ( filename: " QuickELogger " , directory: . caches)
181
+
182
+ expect ( logMessages. count) . to ( equal ( 1 ) )
183
+
184
+ let logMessage = logMessages. first!
185
+
186
+ expect ( logMessage. id) . toNot ( beNil ( ) )
187
+ expect ( logMessage. timeStamp) . toNot ( beNil ( ) )
188
+
189
+ expect ( logMessage. type) . to ( equal ( . info) )
190
+ expect ( logMessage. message) . to ( equal ( " This can be deleted unexpectedly " ) )
191
+ }
192
+ }
193
+
194
+ describe ( " Library " ) {
195
+ beforeEach {
196
+ subject = QuickELoggerObjC ( directory: . library)
197
+
198
+ subject. log ( message: " This is the top-level directory for any files that are not user data files " , type: . info)
199
+ }
200
+
201
+ it ( " writes the log file to the library directory " ) {
202
+ let logMessages = getLogMessages ( filename: " QuickELogger " , directory: . library)
203
+
204
+ expect ( logMessages. count) . to ( equal ( 1 ) )
205
+
206
+ let logMessage = logMessages. first!
207
+
208
+ expect ( logMessage. id) . toNot ( beNil ( ) )
209
+ expect ( logMessage. timeStamp) . toNot ( beNil ( ) )
210
+
211
+ expect ( logMessage. type) . to ( equal ( . info) )
212
+ expect ( logMessage. message) . to ( equal ( " This is the top-level directory for any files that are not user data files " ) )
213
+ }
214
+ }
215
+ }
148
216
}
149
217
}
150
218
}
0 commit comments