Permalink
Browse files

Processing function called with port as context

  • Loading branch information...
1 parent 5ca06ee commit f888e4d365a753108a25e5e09b0cdafc0eea955c Kenneth Kan committed Mar 2, 2014
Showing with 10 additions and 0 deletions.
  1. +10 −0 spec/InPort.coffee
View
@@ -40,6 +40,16 @@ describe 'Inport Port', ->
it 'should not contain a socket initially', ->
chai.expect(p.sockets.length).to.equal 0
+ describe 'with processing function called with port as context', ->
+ it 'should set context to port itself', ->
+ s = new socket
+ p = new inport
+ p.on 'data', (packet, outPorts) ->
+ chai.expect(this).toBe p
+ chai.expect(packet).toEqual 'some-data'
+ p.attach s
+ s.send 'some-data'
+
describe 'with default value', ->
p = s = null
beforeEach ->

0 comments on commit f888e4d

Please sign in to comment.