Created
September 18, 2011 10:59
-
-
Save dakatsuka/1224981 to your computer and use it in GitHub Desktop.
Vowsでイベントを捕捉する
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| vows = require('vows') | |
| assert = require('assert') | |
| events = require('events') | |
| Hoge = require('hoge') | |
| vows | |
| .describe('Hoge') | |
| .addBatch | |
| 'when using foo method': | |
| topic: -> | |
| promise = new events.EventEmitter() | |
| hoge = new Hoge() | |
| setTimeout -> | |
| hoge.foo("bar") | |
| , 100 | |
| hoge.on 'foo', (connection) -> | |
| promise.emit 'success', connection | |
| return promise | |
| 'foo event should be fired': (topic) -> | |
| assert.equal topic, 'bar' | |
| .export module |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment