Skip to content

Commit

Permalink
Merge pull request #1037 from michaelansel/tweak-test
Browse files Browse the repository at this point in the history
Tweak test case to fail better
  • Loading branch information
michaelansel committed Aug 26, 2015
2 parents 980b2d8 + b58e8d1 commit 14692b7
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions test/robot_test.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -748,19 +748,22 @@ describe 'Robot', ->
execution = []

testMiddlewareA = (context, next, done) ->
context.response.message.text = "foobar"
context.response.message.text = 'foobar'
next()

testMiddlewareB = (context, next, done) ->
# Subsequent middleware should see the modified message
expect(context.response.message.text).to.equal("foobar")
next()

@robot.receiveMiddleware testMiddlewareA
@robot.receiveMiddleware testMiddlewareB

@robot.hear /^foobar$/, () ->
# We'll never get to this if testMiddlewareA has not modified the message.
testDone()
testCallback = sinon.spy()
# We'll never get to this if testMiddlewareA has not modified the message.
@robot.hear /^foobar$/, testCallback

testMessage = new TextMessage @user, 'message123'
@robot.receive testMessage
@robot.receive testMessage, ->
expect(testCallback).to.have.been.called
testDone()

0 comments on commit 14692b7

Please sign in to comment.