Skip to content

Commit

Permalink
removing services
Browse files Browse the repository at this point in the history
  • Loading branch information
rafiki270 committed Mar 20, 2018
1 parent 4014186 commit cafcb00
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
24 changes: 24 additions & 0 deletions Sources/VaporTestTools/Extensions/Services/Services+Testing.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// Services+Testing.swift
// VaporTestTools
//
// Created by Ondrej Rafaj on 20/03/2018.
//

import Foundation
@testable import Service


extension TestableProperty where TestableType == Services {

public mutating func remove<S>(type: S.Type) {
if let existing = element.factories.index(where: {
$0.serviceType is S.Type
}) {
element.factories.remove(at: existing)
}
}

}


2 changes: 1 addition & 1 deletion Sources/VaporTestTools/Properties/TestableProperty.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Foundation

public struct TestableProperty<TestableType> {

public let element: TestableType
public var element: TestableType

init(_ obj: TestableType) {
element = obj
Expand Down
1 change: 1 addition & 0 deletions Sources/VaporTestTools/TestTools.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ extension Request: Testable { }
extension HTTPRequest: Testable { }
extension Response: Testable { }
extension Application: Testable { }
extension Services: Testable { }


extension Dictionary: Testable where Key == String, Value == String {
Expand Down

0 comments on commit cafcb00

Please sign in to comment.