Skip to content

Instantly share code, notes, and snippets.

@spiegela
Created May 2, 2014 22:35
Show Gist options
  • Save spiegela/0171c3847ed3e9af9715 to your computer and use it in GitHub Desktop.
Save spiegela/0171c3847ed3e9af9715 to your computer and use it in GitHub Desktop.
{WorkspaceView} = require 'atom'
path = require 'path'
ErlangBuildView = require '../lib/erlang-build-view'
describe "ErlangBuildView", ->
activationPromise = null
beforeEach ->
# Setup access to the current workspace
atom.workspaceView = new WorkspaceView
atom.workspace = atom.workspaceView.model
# Instrument calls to our render function
(spyOn ErlangBuildView.prototype, 'renderMessages').andCallThrough()
# This callback makes sure that tests load after the package is loaded
activationPromise = (atom.packages.activatePackage 'erlang-build')
describe "message panel output", ->
it "sends a message to the message panel", ->
waitsForPromise ->
# Open our workspace
atom.workspace.open ""
runs ->
# Here we trigger the actual editor command
atom.workspaceView.getActiveView().trigger "erlang-build:toggle-messages"
waitsFor ->
# Wait for the trigger to be run based on the "Spied" call-count
ErlangBuildView::renderMessages.callCount > 0
runs ->
# Setup our first expectation
(expect atom.workspaceView.getPanes()).toHaveLength 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment