Add HttpMethod tests
This commit is contained in:
parent
fd381d8bb8
commit
efe908f21c
|
@ -1,3 +1,11 @@
|
||||||
|
//
|
||||||
|
// HttpMethod.swift
|
||||||
|
// SwiftKit
|
||||||
|
//
|
||||||
|
// Created by Daniel Saidi on 2020-09-30.
|
||||||
|
// Copyright © 2021 Daniel Saidi. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -6,14 +14,14 @@ import Foundation
|
||||||
*/
|
*/
|
||||||
public enum HttpMethod: String {
|
public enum HttpMethod: String {
|
||||||
|
|
||||||
case get
|
case connect
|
||||||
case put
|
|
||||||
case post
|
|
||||||
case delete
|
case delete
|
||||||
|
case get
|
||||||
case head
|
case head
|
||||||
case options
|
case options
|
||||||
|
case post
|
||||||
|
case put
|
||||||
case trace
|
case trace
|
||||||
case connect
|
|
||||||
|
|
||||||
public var method: String { rawValue.uppercased() }
|
public var method: String { rawValue.uppercased() }
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
//
|
||||||
|
// HttpMethodTests.swift
|
||||||
|
// SwiftKitTests
|
||||||
|
//
|
||||||
|
// Created by Daniel Saidi on 2020-10-25.
|
||||||
|
// Copyright © 2020 Daniel Saidi. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Quick
|
||||||
|
import Nimble
|
||||||
|
import SwiftKit
|
||||||
|
|
||||||
|
class HttpMethodTests: QuickSpec {
|
||||||
|
|
||||||
|
override func spec() {
|
||||||
|
|
||||||
|
describe("method") {
|
||||||
|
|
||||||
|
func result(for method: HttpMethod) -> String {
|
||||||
|
method.method
|
||||||
|
}
|
||||||
|
|
||||||
|
it("is correct for all cases") {
|
||||||
|
expect(result(for: .connect)).to(equal("CONNECT"))
|
||||||
|
expect(result(for: .delete)).to(equal("DELETE"))
|
||||||
|
expect(result(for: .get)).to(equal("GET"))
|
||||||
|
expect(result(for: .head)).to(equal("HEAD"))
|
||||||
|
expect(result(for: .options)).to(equal("OPTIONS"))
|
||||||
|
expect(result(for: .post)).to(equal("POST"))
|
||||||
|
expect(result(for: .put)).to(equal("PUT"))
|
||||||
|
expect(result(for: .trace)).to(equal("TRACE"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue