Skip to content

Commit

Permalink
more assign test
Browse files Browse the repository at this point in the history
  • Loading branch information
mose committed Jul 18, 2016
1 parent 1cd8093 commit 368b8a8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
1 change: 0 additions & 1 deletion scripts/phabs.coffee
Expand Up @@ -174,7 +174,6 @@ module.exports = (robot) ->
assignee = robot.brain.userForName(who)
if assignee?
phab.withUser msg, assignee, (userPhid) ->
# console.log userPhid
phab.assignTask msg, id, userPhid, (body) ->
if body['result']['error_info'] is undefined
msg.send "Ok. T#{id} is now assigned to #{assignee.name}"
Expand Down
15 changes: 15 additions & 0 deletions test/phabs_test.coffee
Expand Up @@ -487,6 +487,21 @@ describe 'hubot-phabs module', ->
expect(hubotResponse()).to.eql "Sorry, I can't figure out your email address :( " +
"Can you tell me with `.phab me as you@yourdomain.com`?"

context 'task is unknown', ->
beforeEach ->
do nock.disableNetConnect
nock(process.env.PHABRICATOR_URL)
.get('/api/maniphest.edit')
.reply(200, { result: { error_info: 'No such Maniphest task exists.' } })

afterEach ->
nock.cleanAll()

context 'phab assign T424242 to user_with_phid', ->
hubot 'phab assign T424242 to user_with_phid'
it "warns the user that the task does not exist", ->
expect(hubotResponse()).to.eql "No such Maniphest task exists."

# ---------------------------------------------------------------------------------
context 'someone talks about a task', ->
context 'when the task is unknown', ->
Expand Down

0 comments on commit 368b8a8

Please sign in to comment.