Skip to content

Commit cafcb00

Browse files
committed
removing services
1 parent 4014186 commit cafcb00

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//
2+
// Services+Testing.swift
3+
// VaporTestTools
4+
//
5+
// Created by Ondrej Rafaj on 20/03/2018.
6+
//
7+
8+
import Foundation
9+
@testable import Service
10+
11+
12+
extension TestableProperty where TestableType == Services {
13+
14+
public mutating func remove<S>(type: S.Type) {
15+
if let existing = element.factories.index(where: {
16+
$0.serviceType is S.Type
17+
}) {
18+
element.factories.remove(at: existing)
19+
}
20+
}
21+
22+
}
23+
24+

Sources/VaporTestTools/Properties/TestableProperty.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import Foundation
1010

1111
public struct TestableProperty<TestableType> {
1212

13-
public let element: TestableType
13+
public var element: TestableType
1414

1515
init(_ obj: TestableType) {
1616
element = obj

Sources/VaporTestTools/TestTools.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ extension Request: Testable { }
3636
extension HTTPRequest: Testable { }
3737
extension Response: Testable { }
3838
extension Application: Testable { }
39+
extension Services: Testable { }
3940

4041

4142
extension Dictionary: Testable where Key == String, Value == String {

0 commit comments

Comments
 (0)