From de7d9bfcb1e0a217fec9d56d2ff52ae78019fcc0 Mon Sep 17 00:00:00 2001 From: Corey Johnson & Nathan Sobo Date: Tue, 26 Mar 2013 11:00:29 -0600 Subject: [PATCH] Get deactivatePackage specs passing w/ new fixture data --- spec/app/atom-spec.coffee | 14 +++++++------- .../packages/package-with-deactivate/index.coffee | 3 +++ 2 files changed, 10 insertions(+), 7 deletions(-) create mode 100644 spec/fixtures/packages/package-with-deactivate/index.coffee diff --git a/spec/app/atom-spec.coffee b/spec/app/atom-spec.coffee index 1be3f87b1..e4ed8f38c 100644 --- a/spec/app/atom-spec.coffee +++ b/spec/app/atom-spec.coffee @@ -120,22 +120,22 @@ describe "the `atom` global", -> describe ".deactivatePackage(id)", -> describe "atom packages", -> - it "calls `deactivate` on the package's main module and deletes the package's module reference and require cache entry", -> - pack = atom.activatePackage("package-with-module") - expect(atom.getActivePackage("package-with-module")).toBe pack + it "calls `deactivate` on the package's main module", -> + pack = atom.activatePackage("package-with-deactivate") + expect(atom.isPackageActive("package-with-deactivate")).toBeTruthy() spyOn(pack.mainModule, 'deactivate').andCallThrough() - atom.deactivatePackage("package-with-module") + atom.deactivatePackage("package-with-deactivate") expect(pack.mainModule.deactivate).toHaveBeenCalled() - expect(atom.getActivePackage("package-with-module")).toBeUndefined() + expect(atom.isPackageActive("package-with-module")).toBeFalsy() it "absorbs exceptions that are thrown by the package module's serialize methods", -> spyOn(console, 'error') - atom.activatePackage('package-with-module', immediate: true) atom.activatePackage('package-with-serialize-error', immediate: true) + atom.activatePackage('package-with-serialization', immediate: true) atom.deactivatePackages() - expect(atom.packageStates['package-with-module']).toEqual someNumber: 1 expect(atom.packageStates['package-with-serialize-error']).toBeUndefined() + expect(atom.packageStates['package-with-serialization']).toEqual someNumber: 1 expect(console.error).toHaveBeenCalled() describe "texmate packages", -> diff --git a/spec/fixtures/packages/package-with-deactivate/index.coffee b/spec/fixtures/packages/package-with-deactivate/index.coffee new file mode 100644 index 000000000..65517bacd --- /dev/null +++ b/spec/fixtures/packages/package-with-deactivate/index.coffee @@ -0,0 +1,3 @@ +module.exports = + activate: -> + deactivate: ->