Skip to content

Commit

Permalink
fix: Fix error with room destroy without httpd (#40)
Browse files Browse the repository at this point in the history
Check `@robot.server` instead of `@httpd`
  • Loading branch information
mtsmfm committed Jan 14, 2017
1 parent 0cafb36 commit 2c8d45c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/index.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ class MockResponse extends Hubot.Response
@robot.adapter.sendPrivate @envelope, strings...

class MockRobot extends Hubot.Robot
constructor: (@httpd=true) ->
super null, null, @httpd, 'hubot'
constructor: (httpd=true) ->
super null, null, httpd, 'hubot'

@Response = MockResponse

loadAdapter: ->
@adapter = new Room(@, @httpd)
@adapter = new Room(@)

class Room extends Hubot.Adapter
constructor: (@robot, @httpd) ->
constructor: (@robot) ->
@messages = []

@privateMessages = {}
Expand All @@ -40,7 +40,7 @@ class Room extends Hubot.Adapter
@robot.receive(new Hubot.TextMessage(user, message), resolve)

destroy: ->
@robot.server.close() if @httpd
@robot.server.close() if @robot.server

reply: (envelope, strings...) ->
@messages.push ['hubot', "@#{envelope.user.name} #{str}"] for str in strings
Expand Down

0 comments on commit 2c8d45c

Please sign in to comment.