Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Turntable to be initialized with default config #63

Merged
merged 1 commit into from
Jun 28, 2016

Conversation

RLovelett
Copy link
Contributor

@RLovelett RLovelett commented Jun 16, 2016

Most of the other Turntable initializers provide this convenience. Added it to this initializer as well.

(Discovered while working on #61 and #62)

If you look at the example in the comments of #61:

func testMocked() {
    let expectation = self.expectationWithDescription(#function)
    defer { self.waitForExpectationsWithTimeout(50.0, handler: nil) }

    let url = NSURL(string: "http://dfsdfhttpbin.org/hidden-basic-auth/:user/:passwd")!
    let error = NSError(domain: NSURLErrorDomain, code: NSURLErrorDNSLookupFailed, userInfo: nil)
    let track = [TrackFactory.createBadTrack(url, statusCode: 400, error: error)]
    let vinyl = Vinyl(tracks: track)
    let turntable = Turntable(vinyl: vinyl)

    turntable.dataTaskWithURL(url) { (data, response, error) in
        XCTAssertNil(data)
        XCTAssertNil(response)
        XCTAssertNotNil(error)
        print(error)
        expectation.fulfill()
    }.resume()
}

That let turntable = Turntable(vinyl: vinyl) is only possible with this change.

Most of the other Turntable initializers provide this convenience. Added
it to this initializer as well.
@RLovelett RLovelett mentioned this pull request Jun 21, 2016
5 tasks
@RuiAAPeres
Copy link
Member

👍

@RuiAAPeres RuiAAPeres merged commit fc56ad8 into Velhotes:master Jun 28, 2016
@RLovelett RLovelett deleted the turntable-vinyl-initializer branch June 28, 2016 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants