Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/businesscat.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ if process.env.HUBOT_BUSINESS_CAT_JARGON?
additionalJargon = (process.env.HUBOT_BUSINESS_CAT_JARGON).split(',')
jargon = jargon.concat(additionalJargon)

regex = new RegExp jargon.join('|'), 'gi'
regex = new RegExp "\\b(#{jargon.join('|')})\\b", 'gi'

module.exports = (robot) ->
robot.hear regex, (msg) ->
Expand Down
4 changes: 2 additions & 2 deletions test/businesscat_test.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ describe 'hubot-business-cat', ->

it 'does register a hear listener', ->
expect(@robot.hear).to.have.been.calledWithMatch sinon.match( (val) ->
val.test /per se/
val.test 'per se'
)

it 'does NOT register a hear listener', ->
expect(@robot.hear).to.not.have.been.calledWith sinon.match( (val) ->
val.test /cooper seem/
val.test 'cooper seem'
)