From 7f083acdc47251509424f332f52f91fa2815953a Mon Sep 17 00:00:00 2001 From: probablycorey Date: Wed, 22 May 2013 15:31:59 -0700 Subject: [PATCH] Update atom specs --- spec/app/atom-spec.coffee | 31 +++++++++++++------------------ src/app/atom.coffee | 4 ++-- 2 files changed, 15 insertions(+), 20 deletions(-) diff --git a/spec/app/atom-spec.coffee b/spec/app/atom-spec.coffee index 91d6828cb..4f086a605 100644 --- a/spec/app/atom-spec.coffee +++ b/spec/app/atom-spec.coffee @@ -3,6 +3,7 @@ RootView = require 'root-view' {$$} = require 'space-pen' fsUtils = require 'fs-utils' Exec = require('child_process').exec +path = require('path') describe "the `atom` global", -> beforeEach -> @@ -24,7 +25,7 @@ describe "the `atom` global", -> describe "when the package has a main module", -> describe "when the metadata specifies a main module path˜", -> it "requires the module at the specified path", -> - mainModule = require('package-with-main/main-module') + mainModule = require('fixtures/packages/package-with-main/main-module') spyOn(mainModule, 'activate') pack = atom.activatePackage('package-with-main') expect(mainModule.activate).toHaveBeenCalled() @@ -32,7 +33,7 @@ describe "the `atom` global", -> describe "when the metadata does not specify a main module", -> it "requires index.coffee", -> - indexModule = require('package-with-index/index') + indexModule = require('fixtures/packages/package-with-index/index') spyOn(indexModule, 'activate') pack = atom.activatePackage('package-with-index') expect(indexModule.activate).toHaveBeenCalled() @@ -48,7 +49,7 @@ describe "the `atom` global", -> [mainModule, pack] = [] beforeEach -> - mainModule = require 'package-with-activation-events/index' + mainModule = require 'fixtures/packages/package-with-activation-events/index' spyOn(mainModule, 'activate').andCallThrough() AtomPackage = require 'atom-package' spyOn(AtomPackage.prototype, 'requireMainModule').andCallThrough() @@ -130,9 +131,9 @@ describe "the `atom` global", -> describe "stylesheet loading", -> describe "when the metadata contains a 'stylesheets' manifest", -> it "loads stylesheets from the stylesheets directory as specified by the manifest", -> - one = fsUtils.resolveOnLoadPath("package-with-stylesheets-manifest/stylesheets/1.css") - two = fsUtils.resolveOnLoadPath("package-with-stylesheets-manifest/stylesheets/2.less") - three = fsUtils.resolveOnLoadPath("package-with-stylesheets-manifest/stylesheets/3.css") + one = fsUtils.resolveOnLoadPath("fixtures/packages/package-with-stylesheets-manifest/stylesheets/1.css") + two = fsUtils.resolveOnLoadPath("fixtures/packages/package-with-stylesheets-manifest/stylesheets/2.less") + three = fsUtils.resolveOnLoadPath("fixtures/packages/package-with-stylesheets-manifest/stylesheets/3.css") expect(stylesheetElementForId(one)).not.toExist() expect(stylesheetElementForId(two)).not.toExist() expect(stylesheetElementForId(three)).not.toExist() @@ -146,9 +147,9 @@ describe "the `atom` global", -> describe "when the metadata does not contain a 'stylesheets' manifest", -> it "loads all stylesheets from the stylesheets directory", -> - one = fsUtils.resolveOnLoadPath("package-with-stylesheets/stylesheets/1.css") - two = fsUtils.resolveOnLoadPath("package-with-stylesheets/stylesheets/2.less") - three = fsUtils.resolveOnLoadPath("package-with-stylesheets/stylesheets/3.css") + one = fsUtils.resolveOnLoadPath("fixtures/packages/package-with-stylesheets/stylesheets/1.css") + two = fsUtils.resolveOnLoadPath("fixtures/packages/package-with-stylesheets/stylesheets/2.less") + three = fsUtils.resolveOnLoadPath("fixtures/packages/package-with-stylesheets/stylesheets/3.css") expect(stylesheetElementForId(one)).not.toExist() expect(stylesheetElementForId(two)).not.toExist() expect(stylesheetElementForId(three)).not.toExist() @@ -254,15 +255,9 @@ describe "the `atom` global", -> atom.deactivatePackage('ruby.tmbundle') expect(syntax.getProperty(['.source.ruby'], 'editor.commentStart')).toBeUndefined() - describe ".getVersion(callback)", -> - it "calls the callback with the current version number", -> - versionHandler = jasmine.createSpy("versionHandler") - atom.getVersion(versionHandler) - waitsFor -> - versionHandler.callCount > 0 - - runs -> - expect(versionHandler.argsForCall[0][0]).toBeDefined() + describe ".getVersion", -> + it "returns the current version number", -> + expect(atom.getVersion()).toBeInstanceOf String describe "modal native dialogs", -> beforeEach -> diff --git a/src/app/atom.coffee b/src/app/atom.coffee index 2938c0062..dc95446c8 100644 --- a/src/app/atom.coffee +++ b/src/app/atom.coffee @@ -259,5 +259,5 @@ window.atom = catch error console.error "Failed to load `#{userInitScriptPath}`", error.stack, error - getVersion: (callback) -> - @sendMessageToBrowserProcess('getVersion', null, callback) + getVersion: -> + @sendMessageToBrowserProcess('getVersion')