Skip to content

robot.http has no effect in tests #19

@pchaigno

Description

@pchaigno

It looks like there is an issue with robot.http when using hubot-test-helper. The following script works fine with a Hubot shell but the associated test does not seem to trigger any HTTP request.

Script:

module.exports = (robot) ->
  robot.hear /(http(?:s?):\/\/(\S*))/i, (res) ->
    url = res.match[1]
    res.send "ok1: #{url}"
    robot.http(url).get() (err, response, body) ->
      res.send "ok2: #{url}"

Test:

context "user posts link", ->
    beforeEach ->
      room.user.say 'user1', 'http://google.com'

    it 'hubot posts details about the link', ->
      expect(room.messages).to.eql [
        ['user1', 'http://google.com']
        ['hubot', 'ok1: http://google.com']
        ['hubot', 'ok2: http://google.com']
      ]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions