rename createAt to be in line with modern swift coding style and add a test

This commit is contained in:
Jake Van Alstyne 🎩 2017-08-09 13:58:55 -06:00
parent 18691cb4e6
commit 7ecfb710d3
2 changed files with 15 additions and 1 deletions

View File

@ -104,7 +104,7 @@ final public class Repository {
/// URL - The URL of the repository.
///
/// Returns a `Result` with a `Repository` or an error.
class public func createAt(_ url: URL) -> Result<Repository, NSError> {
class public func create(at url: URL) -> Result<Repository, NSError> {
var pointer: OpaquePointer? = nil
let result = url.withUnsafeFileSystemRepresentation {
git_repository_init(&pointer, $0, 0)

View File

@ -30,6 +30,20 @@ class RepositorySpec: QuickSpec {
}
}
describe("Repository.Type.create(at:)") {
it("should create a new repo at the specified location") {
let remoteRepo = Fixtures.simpleRepository
let localURL = self.temporaryURL(forPurpose: "local-create")
let result = Repository.create(at: localURL)
expect(result).to(haveSucceeded())
if case .success(let clonedRepo) = result {
expect(clonedRepo.directoryURL).notTo(beNil())
}
}
}
describe("Repository.Type.clone(from:to:)") {
it("should handle local clones") {
let remoteRepo = Fixtures.simpleRepository