diff --git a/spec/fixtures/git/master.git/config b/spec/fixtures/git/master.git/config index af107929f..c9da546d6 100644 --- a/spec/fixtures/git/master.git/config +++ b/spec/fixtures/git/master.git/config @@ -4,3 +4,6 @@ bare = false logallrefupdates = true ignorecase = true +[remote "origin"] + url = https://github.com/example-user/example-repo.git + fetch = +refs/heads/*:refs/remotes/origin/* diff --git a/spec/project-spec.js b/spec/project-spec.js index e7601253c..861a0f53a 100644 --- a/spec/project-spec.js +++ b/spec/project-spec.js @@ -1000,10 +1000,13 @@ describe('Project', () => { const observed = [] const disposable = atom.project.onDidAddRepository((repo) => observed.push(repo)) - const repositoryPath = path.join(__dirname, '..') - atom.project.addPath(repositoryPath) + const projectRootPath = temp.mkdirSync() + const fixtureRepoPath = fs.absolute(path.join(__dirname, 'fixtures', 'git', 'master.git')) + fs.copySync(fixtureRepoPath, path.join(projectRootPath, '.git')) + + atom.project.addPath(projectRootPath) expect(observed.length).toBe(1) - expect(observed[0].getOriginURL()).toContain('atom/atom') + expect(observed[0].getOriginURL()).toEqual('https://github.com/example-user/example-repo.git') disposable.dispose() }) @@ -1012,9 +1015,16 @@ describe('Project', () => { const observed = [] const disposable = atom.project.onDidAddRepository((repo) => observed.push(repo)) - atom.project.addPath(__dirname) + const projectRootPath = temp.mkdirSync() + const fixtureRepoPath = fs.absolute(path.join(__dirname, 'fixtures', 'git', 'master.git')) + fs.copySync(fixtureRepoPath, path.join(projectRootPath, '.git')) + + const projectSubDirPath = path.join(projectRootPath, 'sub-dir') + fs.mkdirSync(projectSubDirPath) + + atom.project.addPath(projectSubDirPath) expect(observed.length).toBe(1) - expect(observed[0].getOriginURL()).toContain('atom/atom') + expect(observed[0].getOriginURL()).toEqual('https://github.com/example-user/example-repo.git') disposable.dispose() })