Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test sendPrivate to specific user #38

Open
sbounmy opened this issue Oct 4, 2016 · 1 comment
Open

test sendPrivate to specific user #38

sbounmy opened this issue Oct 4, 2016 · 1 comment

Comments

@sbounmy
Copy link

sbounmy commented Oct 4, 2016

Hey,

Is there a way to test when bot initiate a private message ?
ex:

//script
module.exports = (robot) ->
  robot.hear /onboard (@.*)/, (res) ->
    name = res.match[1]
    res.send "Glad to see a new face! Onboarding #{name} right now"
    res.sendPrivate name, "hey #{name} can you tell me your secret password ?"
//test
  it 'initiate a private message to user', ->
    @room.user.say('stephane', 'onboard @arthur 28/10').then =>
      expect(@room.privateMessages).to.eql {
        'arthur': [
          ['hubot', 'hey @arthur can you tell me your secret password ?']
        ]
      }
@faridnsh
Copy link
Contributor

You can do this using robot.sendPrivate. Should exactly do what you want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants