Destroy repo in an afterEach in Git specs

This commit is contained in:
Kevin Sawicki
2013-02-15 09:40:32 -08:00
parent ee3f5a3c14
commit 4cfd2b41fb

View File

@@ -2,10 +2,14 @@ Git = require 'git'
fs = require 'fs'
describe "Git", ->
repo = null
beforeEach ->
fs.remove('/tmp/.git') if fs.isDirectory('/tmp/.git')
afterEach ->
repo.destroy() if repo?.repo?
describe "@open(path)", ->
it "returns null when no repository is found", ->
expect(Git.open('/tmp/nogit.txt')).toBeNull()
@@ -71,7 +75,7 @@ describe "Git", ->
expect(repo.isPathModified(newPath)).toBeFalsy()
describe ".isPathNew(path)", ->
[repo, path, newPath] = []
[path, newPath] = []
beforeEach ->
repo = new Git(require.resolve('fixtures/git/working-dir'))
@@ -90,7 +94,7 @@ describe "Git", ->
expect(repo.isPathNew(path)).toBeFalsy()
describe ".checkoutHead(path)", ->
[repo, path1, path2, originalPath1Text, originalPath2Text] = []
[path1, path2, originalPath1Text, originalPath2Text] = []
beforeEach ->
repo = new Git(require.resolve('fixtures/git/working-dir'))
@@ -129,7 +133,7 @@ describe "Git", ->
expect(-> repo.getHead()).toThrow()
describe ".getDiffStats(path)", ->
[repo, path, originalPathText] = []
[path, originalPathText] = []
beforeEach ->
repo = new Git(require.resolve('fixtures/git/working-dir'))