mirror of
https://github.com/gosticks/SwiftGit2.git
synced 2025-10-16 11:55:34 +00:00
rename createAt to be in line with modern swift coding style and add a test
This commit is contained in:
parent
18691cb4e6
commit
7ecfb710d3
@ -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)
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user