diff --git a/SwiftGit2Tests/RepositorySpec.swift b/SwiftGit2Tests/RepositorySpec.swift index d021f45..e0104a4 100644 --- a/SwiftGit2Tests/RepositorySpec.swift +++ b/SwiftGit2Tests/RepositorySpec.swift @@ -685,43 +685,43 @@ class RepositorySpec: QuickSpec { expect(commitMessages).to(equal(expectedMessages)) } } - + describe("Repository.add") { it("Should add the modification under a path") { let repo = Fixtures.simpleRepository let branch = repo.localBranch(named: "master").value! expect(repo.checkout(branch, strategy: CheckoutStrategy.None).error).to(beNil()) - + // make a change to README let readmeURL = repo.directoryURL!.appendingPathComponent("README.md") let readmeData = try! Data(contentsOf: readmeURL) defer { try! readmeData.write(to: readmeURL) } - + try! "different".data(using: .utf8)?.write(to: readmeURL) - + let status = repo.status() expect(status.value?.count).to(equal(1)) expect(status.value!.first!.status).to(equal(.workTreeModified)) - + expect(repo.add(path: "README.md").error).to(beNil()) - + let newStatus = repo.status() expect(newStatus.value?.count).to(equal(1)) expect(newStatus.value!.first!.status).to(equal(.indexModified)) } - + it("Should add an untracked file under a path") { let repo = Fixtures.simpleRepository let branch = repo.localBranch(named: "master").value! expect(repo.checkout(branch, strategy: CheckoutStrategy.None).error).to(beNil()) - + // make a change to README let untrackedURL = repo.directoryURL!.appendingPathComponent("untracked") try! "different".data(using: .utf8)?.write(to: untrackedURL) defer { try! FileManager.default.removeItem(at: untrackedURL) } - + expect(repo.add(path: ".").error).to(beNil()) - + let newStatus = repo.status() expect(newStatus.value?.count).to(equal(1)) expect(newStatus.value!.first!.status).to(equal(.indexNew)) @@ -733,13 +733,13 @@ class RepositorySpec: QuickSpec { let repo = Fixtures.simpleRepository let branch = repo.localBranch(named: "master").value! expect(repo.checkout(branch, strategy: CheckoutStrategy.None).error).to(beNil()) - + // make a change to README let untrackedURL = repo.directoryURL!.appendingPathComponent("untrackedtest") try! "different".data(using: .utf8)?.write(to: untrackedURL) - + expect(repo.add(path: ".").error).to(beNil()) - + let signature = Signature( name: "swiftgit2", email: "foobar@example.com", @@ -753,17 +753,17 @@ class RepositorySpec: QuickSpec { expect(repo.commits(in: updatedBranch).next()?.value?.committer).to(equal(signature)) expect(repo.commits(in: updatedBranch).next()?.value?.message).to(equal("\(message)\n")) expect(repo.commits(in: updatedBranch).next()?.value?.oid.description).to(equal("7d6b2d7492f29aee48022387f96dbfe996d435fe")) - + // should be clean now let newStatus = repo.status() expect(newStatus.value?.count).to(equal(0)) } } - + describe("Repository.status") { it("Should accurately report status for repositories with no status") { let expectedCount = 0 - + let repo = Fixtures.mantleRepository let branch = repo.localBranch(named: "master").value! expect(repo.checkout(branch, strategy: CheckoutStrategy.None).error).to(beNil())