diff --git a/spec/app/root-view-spec.coffee b/spec/app/root-view-spec.coffee index b4bf6eed6..9287b8ee7 100644 --- a/spec/app/root-view-spec.coffee +++ b/spec/app/root-view-spec.coffee @@ -155,13 +155,13 @@ describe "RootView", -> it "absorbs exceptions that are thrown by the package module's serialize methods", -> spyOn(console, 'error') - rootView.activatePackage "REMOVE THIS", + rootView.activatePackage name: "bad-egg" packageMain: activate: -> serialize: -> throw new Error("I'm broken") - rootView.activatePackage "REMOVE THIS", + rootView.activatePackage name: "good-egg" packageMain: activate: -> @@ -436,28 +436,28 @@ describe "RootView", -> describe ".activatePackage(name, package)", -> it "calls activate on the package", -> - rootView.activatePackage('REMOVE ME', pack) + rootView.activatePackage(pack) expect(packageModule.activate).toHaveBeenCalledWith(undefined) it "calls activate on the package module with its previous state", -> - rootView.activatePackage('REMOVE ME', pack) + rootView.activatePackage(pack) packageModule.activate.reset() newRootView = RootView.deserialize(rootView.serialize()) - newRootView.activatePackage('REMOVE ME', pack) + newRootView.activatePackage(pack) expect(packageModule.activate).toHaveBeenCalledWith("it worked") newRootView.remove() describe ".deactivatePackage(packageName)", -> it "deactivates and removes the package module from the package module map", -> - rootView.activatePackage('REMOVE ME', pack) + rootView.activatePackage(pack) spyOn(packageModule, "deactivate").andCallThrough() rootView.deactivatePackages() expect(packageModule.deactivate).toHaveBeenCalled() expect(rootView.packages.length).toBe 0 it "is called when the rootView is deactivated to deactivate all packages", -> - rootView.activatePackage('package', pack) + rootView.activatePackage(pack) spyOn(packageModule, "deactivate").andCallThrough() rootView.deactivate() expect(packageModule.deactivate).toHaveBeenCalled() diff --git a/src/app/atom-package.coffee b/src/app/atom-package.coffee index 4612779d9..c6363c32b 100644 --- a/src/app/atom-package.coffee +++ b/src/app/atom-package.coffee @@ -65,7 +65,7 @@ class AtomPackage extends Package if fs.isFile(mainPath) @packageMain = require(mainPath) config.setDefaults(@name, @packageMain.configDefaults) - rootView?.activatePackage(@name, this) + rootView?.activatePackage(this) loadMetadata: -> if metadataPath = fs.resolveExtension(fs.join(@path, 'package'), ['cson', 'json']) diff --git a/src/app/root-view.coffee b/src/app/root-view.coffee index 96692c429..86525ed47 100644 --- a/src/app/root-view.coffee +++ b/src/app/root-view.coffee @@ -262,7 +262,7 @@ class RootView extends View eachBuffer: (callback) -> @project.eachBuffer(callback) - activatePackage: (name, pack) -> + activatePackage: (pack) -> @packages.push(pack) pack.packageMain.activate(@packageStates[pack.name])