From 6b26863012905187d199d34fb755c080c5384858 Mon Sep 17 00:00:00 2001 From: joshaber Date: Fri, 25 Mar 2016 15:41:05 -0400 Subject: [PATCH] Revert "Fix the specs." This reverts commit 39dcd59994d11e1cefde849bb5080f47460eb69f. --- spec/git-repository-async-spec.js | 6 +++--- spec/git-spec.coffee | 22 +++++++++------------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/spec/git-repository-async-spec.js b/spec/git-repository-async-spec.js index 25623ae27..900d81bfb 100644 --- a/spec/git-repository-async-spec.js +++ b/spec/git-repository-async-spec.js @@ -483,10 +483,9 @@ describe('GitRepositoryAsync', () => { describe('buffer events', () => { let repo - let workingDirectory beforeEach(() => { - workingDirectory = copyRepository() + const workingDirectory = copyRepository() atom.project.setPaths([workingDirectory]) // When the path is added to the project, the repository is refreshed. We @@ -513,9 +512,10 @@ describe('GitRepositoryAsync', () => { }) it('emits a status-changed event when a buffer is reloaded', async () => { - fs.writeFileSync(path.join(workingDirectory, 'other.txt'), 'changed') const editor = await atom.workspace.open('other.txt') + fs.writeFileSync(editor.getPath(), 'changed') + const statusHandler = jasmine.createSpy('statusHandler') repo.onDidChangeStatus(statusHandler) editor.getBuffer().reload() diff --git a/spec/git-spec.coffee b/spec/git-spec.coffee index db42f3fc8..3afd4da75 100644 --- a/spec/git-spec.coffee +++ b/spec/git-spec.coffee @@ -290,11 +290,10 @@ describe "GitRepository", -> expect(repo.isStatusNew(status)).toBe false describe "buffer events", -> - [editor, workingDirectory] = [] + [editor] = [] beforeEach -> - workingDirectory = copyRepository() - atom.project.setPaths([workingDirectory]) + atom.project.setPaths([copyRepository()]) waitsForPromise -> atom.workspace.open('other.txt').then (o) -> editor = o @@ -311,16 +310,13 @@ describe "GitRepository", -> it "emits a status-changed event when a buffer is reloaded", -> fs.writeFileSync(editor.getPath(), 'changed') - waitsForPromise -> - atom.workspace.open(path.join(workingDirectory, 'other.txt')).then (o) -> editor = o - runs -> - statusHandler = jasmine.createSpy('statusHandler') - atom.project.getRepositories()[0].onDidChangeStatus statusHandler - editor.getBuffer().reload() - expect(statusHandler.callCount).toBe 1 - expect(statusHandler).toHaveBeenCalledWith {path: editor.getPath(), pathStatus: 256} - editor.getBuffer().reload() - expect(statusHandler.callCount).toBe 1 + statusHandler = jasmine.createSpy('statusHandler') + atom.project.getRepositories()[0].onDidChangeStatus statusHandler + editor.getBuffer().reload() + expect(statusHandler.callCount).toBe 1 + expect(statusHandler).toHaveBeenCalledWith {path: editor.getPath(), pathStatus: 256} + editor.getBuffer().reload() + expect(statusHandler.callCount).toBe 1 it "emits a status-changed event when a buffer's path changes", -> fs.writeFileSync(editor.getPath(), 'changed')