mirror of
https://github.com/gosticks/SwiftGit2.git
synced 2025-10-16 11:55:34 +00:00
59 lines
1.5 KiB
Swift
59 lines
1.5 KiB
Swift
//
|
|
// RepositorySpec.swift
|
|
// RepositorySpec
|
|
//
|
|
// Created by Matt Diephouse on 11/7/14.
|
|
// Copyright (c) 2014 GitHub, Inc. All rights reserved.
|
|
//
|
|
|
|
import LlamaKit
|
|
import SwiftGit2
|
|
import Nimble
|
|
import Quick
|
|
|
|
class RepositorySpec: QuickSpec {
|
|
override func spec() {
|
|
describe("+atURL()") {
|
|
it("should work if the repo exists") {
|
|
let repo = Fixtures.simpleRepository
|
|
expect(repo.directoryURL).notTo(beNil())
|
|
}
|
|
|
|
it("should fail if the repo doesn't exist") {
|
|
let url = NSURL(fileURLWithPath: "blah")!
|
|
let result = Repository.atURL(url)
|
|
expect(result.error()).notTo(beNil())
|
|
}
|
|
}
|
|
|
|
describe("-commitWithOID") {
|
|
it("should return the commit if it exists") {
|
|
let repo = Fixtures.simpleRepository
|
|
let oid = OID(string: "dc220a3f0c22920dab86d4a8d3a3cb7e69d6205a")!
|
|
|
|
let result = repo.commitWithOID(oid)
|
|
let commit = result.value()
|
|
expect(commit).notTo(beNil())
|
|
expect(commit?.oid).to(equal(oid))
|
|
}
|
|
|
|
it("should error if the commit doesn't exist") {
|
|
let repo = Fixtures.simpleRepository
|
|
let oid = OID(string: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")!
|
|
|
|
let result = repo.commitWithOID(oid)
|
|
expect(result.error()).notTo(beNil())
|
|
}
|
|
|
|
it("should error if the oid doesn't point to a commit") {
|
|
let repo = Fixtures.simpleRepository
|
|
// This is a tree in the repository
|
|
let oid = OID(string: "f93e3a1a1525fb5b91020da86e44810c87a2d7bc")!
|
|
|
|
let result = repo.commitWithOID(oid)
|
|
expect(result.error()).notTo(beNil())
|
|
}
|
|
}
|
|
}
|
|
}
|