pulsar/spec/atom/app-spec.coffee

25 lines
612 B
CoffeeScript
Raw Normal View History

App = require 'app'
fs = require 'fs'
2011-12-13 04:24:55 +04:00
describe "App", ->
app = null
2011-12-13 04:24:55 +04:00
beforeEach ->
app = new App()
2011-12-13 04:24:55 +04:00
afterEach ->
window.close() for window in app.windows()
2011-12-13 04:24:55 +04:00
describe "open", ->
it "loads a buffer based on the given path and displays it in a new window", ->
filePath = require.resolve 'fixtures/sample.txt'
expect(app.windows().length).toBe 0
2011-12-13 04:24:55 +04:00
app.open filePath
2011-12-13 04:24:55 +04:00
expect(app.windows().length).toBe 1
newWindow = app.windows()[0]
expect(newWindow.editor.buffer.url).toEqual filePath
expect(newWindow.editor.buffer.getText()).toEqual fs.read(filePath)