diff --git a/CHANGELOG.md b/CHANGELOG.md index 302933ce..c7685573 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ # OHHTTPStubs — CHANGELOG +## [4.7.0](https://github.com/AliSoftware/OHHTTPStubs/releases/tag/4.7.0) + +* Added `isMethodPATCH()` to the `Swift` helpers. + [@attheodo](https://github.com/attheodo)([#145](https://github.com/AliSoftware/OHHTTPStubs/issues/145)) ## [4.6.0](https://github.com/AliSoftware/OHHTTPStubs/releases/tag/4.5.1) @@ -62,7 +66,7 @@ * Fix threading in `NSURLProtocol` subclass calling `NSURLProtocolClient` callbacks from wrong thread. [@nsprogrammer](https://github.com/nsprogrammer), [#96](https://github.com/AliSoftware/OHHTTPStubs/pull/96) -## [4.0.0](https://github.com/AliSoftware/OHHTTPStubs/releases/tag/4.0.0) — Improvements for Swift +## [4.0.0](https://github.com/AliSoftware/OHHTTPStubs/releases/tag/4.0.0) — Improvements for Swift * Annotated the library with _nullability_ attributes to generate a better API when used in Swift * Migrated the path utility macros to functions in `OHPathHelpers.h`, for Swift compatibility ([#100](https://github.com/AliSoftware/OHHTTPStubs/issues/100)). diff --git a/OHHTTPStubs.podspec b/OHHTTPStubs.podspec index 580251db..67408c81 100644 --- a/OHHTTPStubs.podspec +++ b/OHHTTPStubs.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "OHHTTPStubs" - s.version = "4.6.0" + s.version = "4.7.0" s.summary = "Framework to stub your network requests like HTTP and help you write network unit tests with XCTest." s.description = <<-DESC.gsub(/^ +\|/,'') @@ -83,7 +83,7 @@ Pod::Spec.new do |s| swift.osx.deployment_target = '10.9' swift.watchos.deployment_target = '2.0' swift.tvos.deployment_target = '9.0' - + swift.dependency 'OHHTTPStubs/Core' swift.source_files = "OHHTTPStubs/Sources/Swift/*.swift" end diff --git a/OHHTTPStubs/Sources/Swift/OHHTTPStubsSwift.swift b/OHHTTPStubs/Sources/Swift/OHHTTPStubsSwift.swift index 3452ae38..2e75aee7 100644 --- a/OHHTTPStubs/Sources/Swift/OHHTTPStubsSwift.swift +++ b/OHHTTPStubs/Sources/Swift/OHHTTPStubsSwift.swift @@ -91,6 +91,16 @@ public func isMethodPUT() -> OHHTTPStubsTestBlock { return { $0.HTTPMethod == "PUT" } } +/** + * Matcher testing that the `NSURLRequest` is using the **PATCH** `HTTPMethod` + * + * - Returns: a matcher (OHHTTPStubsTestBlock) that succeeds only if the request + * is using the PATCH method + */ +public func isMethodPATCH() -> OHHTTPStubsTestBlock { + return { $0.HTTPMethod == "PATCH" } +} + /** * Matcher testing that the `NSURLRequest` is using the **DELETE** `HTTPMethod` * diff --git a/OHHTTPStubs/UnitTests/Test Suites/SwiftHelpersTests.swift b/OHHTTPStubs/UnitTests/Test Suites/SwiftHelpersTests.swift index 9ab4478b..99735b2b 100644 --- a/OHHTTPStubs/UnitTests/Test Suites/SwiftHelpersTests.swift +++ b/OHHTTPStubs/UnitTests/Test Suites/SwiftHelpersTests.swift @@ -13,8 +13,8 @@ import OHHTTPStubs class SwiftHelpersTests : XCTestCase { func testHTTPMethod() { - let methods = ["GET","PUT","POST","DELETE","FOO"] - let matchers = [isMethodGET(), isMethodPUT(), isMethodPOST(), isMethodDELETE()] + let methods = ["GET", "PUT", "PATCH", "POST", "DELETE", "FOO"] + let matchers = [isMethodGET(), isMethodPUT(), isMethodPATCH(), isMethodPOST(), isMethodDELETE()] for (idxMethod, method) in methods.enumerate() { let req = NSMutableURLRequest(URL: NSURL(string: "foo://bar")!)