Add HttpMethod tests

This commit is contained in:
Daniel Saidi 2021-09-08 10:26:22 +02:00
parent fd381d8bb8
commit efe908f21c
2 changed files with 47 additions and 4 deletions

View File

@ -1,3 +1,11 @@
//
// HttpMethod.swift
// SwiftKit
//
// Created by Daniel Saidi on 2020-09-30.
// Copyright © 2021 Daniel Saidi. All rights reserved.
//
import Foundation
/**
@ -6,14 +14,14 @@ import Foundation
*/
public enum HttpMethod: String {
case get
case put
case post
case connect
case delete
case get
case head
case options
case post
case put
case trace
case connect
public var method: String { rawValue.uppercased() }
}

View File

@ -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"))
}
}
}
}