Skip to content

Commit 6efca19

Browse files
committed
Update README for Swift 3.0
This reverts commit 2ddd3af.
1 parent 2661dd9 commit 6efca19

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Mockingjay has full integration to XCTest and you simply just need to register a
1818

1919
```swift
2020
let body = [ "user": "Kyle" ]
21-
stub(uri("/{user}/{repository}"), builder: json(body))
21+
stub(uri("/{user}/{repository}"), json(body))
2222
```
2323

2424
The `uri` function takes a URL or path which can have a [URI Template](https://github.com/kylef/URITemplate.swift). Such as the following:
@@ -32,22 +32,24 @@ The `uri` function takes a URL or path which can have a [URI Template](https://g
3232

3333
```swift
3434
let body = [ "description": "Kyle" ]
35-
stub(http(.PUT, uri: "/kylef/Mockingjay"), builder: json(body))
35+
stub(http(.PUT, "/kylef/Mockingjay"), json(body))
3636
```
3737

3838
#### Stubbing everything request to result in an error
3939

4040
```swift
41-
let error = NSError(domain: "Mockingjay Session Tests", code: 0, userInfo: nil)
42-
stub(everything, builder: failure(error))
41+
let error = NSError()
42+
stub(everything, failure(error))
4343
```
4444

4545
#### Stub with a specific HTTP response
4646

4747
```swift
48-
stub(everything, builder: http(404, headers: nil, data: nil))
48+
stub(everything, http(status: 404))
4949
```
5050

51+
*Note, the `http` builder can take a set of headers and a body too.*
52+
5153
## Stub
5254

5355
The `stub` method in Mockingjay takes two functions or closures, one to match the request and another to build the response. This allows you to easily extend the syntax to provide your own specific functions.
@@ -65,7 +67,7 @@ func matcher(request:NSURLRequest) -> Bool {
6567
return true // Let's match this request
6668
}
6769

68-
stub(matcher, builder: failure(error))
70+
stub(matcher, failure(error))
6971
```
7072

7173
### Builders
@@ -78,7 +80,7 @@ func builder(request:NSURLRequest) -> Response {
7880
return .Success(response, .NoContent)
7981
}
8082

81-
stub(matcher, builder: builder)
83+
stub(matcher, builder)
8284
```
8385

8486
### Generics

0 commit comments

Comments
 (0)