mirror of
https://github.com/atom/atom.git
synced 2026-01-23 13:58:08 -05:00
split up one of the tests in git-repository-provider-spec.coffee
This commit is contained in:
@@ -7,11 +7,10 @@ describe "GitRepositoryProvider", ->
|
||||
describe ".repositoryForDirectory(directory)", ->
|
||||
|
||||
describe "when specified a Directory with a Git repository", ->
|
||||
provider = new GitRepositoryProvider atom.project
|
||||
theResult = 'dummy_value'
|
||||
theSecondResult = 'dummy_value2'
|
||||
|
||||
it "returns a Promise that resolves to a GitRepository", ->
|
||||
provider = new GitRepositoryProvider atom.project
|
||||
theResult = null
|
||||
|
||||
waitsForPromise ->
|
||||
directory = new Directory path.join(__dirname, 'fixtures/git/master.git')
|
||||
provider.repositoryForDirectory(directory).then (result) -> theResult = result
|
||||
@@ -21,13 +20,22 @@ describe "GitRepositoryProvider", ->
|
||||
expect(provider.pathToRepository[theResult.getPath()]).toBeTruthy()
|
||||
expect(theResult.statusTask).toBeTruthy()
|
||||
|
||||
it "returns the same GitRepository for different Directory objects in the same repo", ->
|
||||
provider = new GitRepositoryProvider atom.project
|
||||
firstRepo = null
|
||||
secondRepo = null
|
||||
|
||||
waitsForPromise ->
|
||||
directory = new Directory path.join(__dirname, 'fixtures/git/master.git')
|
||||
provider.repositoryForDirectory(directory).then (result) -> firstRepo = result
|
||||
|
||||
waitsForPromise ->
|
||||
directory = new Directory path.join(__dirname, 'fixtures/git/master.git/objects')
|
||||
provider.repositoryForDirectory(directory).then (result) -> theSecondResult = result
|
||||
provider.repositoryForDirectory(directory).then (result) -> secondRepo = result
|
||||
|
||||
runs ->
|
||||
expect(theSecondResult).toBeInstanceOf GitRepository
|
||||
expect(theSecondResult).toBe theResult
|
||||
expect(firstRepo).toBeInstanceOf GitRepository
|
||||
expect(firstRepo).toBe secondRepo
|
||||
|
||||
describe "when specified a Directory without a Git repository", ->
|
||||
provider = new GitRepositoryProvider atom.project
|
||||
|
||||
Reference in New Issue
Block a user