lita-message-router 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/lita/handlers/message_router.rb +1 -1
- data/lita-message-router.gemspec +1 -1
- data/spec/lita/handlers/message_router_spec.rb +29 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 93c11ca67149f3656d6dabffeb814eb668c870f0
|
4
|
+
data.tar.gz: da08fab81da0d0a7dd062b699e57f423b3abb921
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a740d74b748bc7d128d8e756fa547ff13d8e8182bf0d33da49781c353e75de3b88ac0a0563a33693847899faeb06bfc75149c1e3e53e47cc06ffe6d18f2345c1
|
7
|
+
data.tar.gz: e7cea5b82ee7189e9d68c1eca4ff8fbdaadaf4915c439f8f1839de26fe3e7d102461e9e3f43998d8d036072ee5e549d10d75d03b0ed6f7af8351b4f4206f5b04
|
@@ -19,7 +19,7 @@ module Lita
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def match(message)
|
22
|
-
regex = Regexp.
|
22
|
+
regex = /^(#{config.robot_mention_names.map { |n| Regexp.escape(n) }.join('|')})\s*(.+)/
|
23
23
|
matches = message.match(regex)
|
24
24
|
matches[2] if matches
|
25
25
|
end
|
data/lita-message-router.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = "lita-message-router"
|
3
|
-
spec.version = "0.1.
|
3
|
+
spec.version = "0.1.6"
|
4
4
|
spec.authors = ["Taylor Lapeyre"]
|
5
5
|
spec.email = ["taylorlapeyre@gmail.com"]
|
6
6
|
spec.description = "This handler allows you to specify as many 'mention names' as you want for your Lita robot."
|
@@ -1,12 +1,39 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe Lita::Handlers::MessageRouter, lita_handler: true do
|
4
|
+
let(:greetings) do
|
5
|
+
Class.new(Lita::Handler) do
|
6
|
+
def self.name
|
7
|
+
'Greetings'
|
8
|
+
end
|
9
|
+
|
10
|
+
route(/^hello world/, :hello, command: true)
|
11
|
+
|
12
|
+
def hello(response)
|
13
|
+
response.reply('hi')
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
4
18
|
before do
|
5
|
-
registry.
|
19
|
+
registry.register_handler(greetings)
|
20
|
+
registry.config.handlers.message_router.robot_mention_names = ['!', '%', '.']
|
6
21
|
end
|
7
22
|
|
8
|
-
it 'routes correctly' do
|
23
|
+
it 'routes configured mention names correctly' do
|
9
24
|
send_message('! hello world')
|
10
25
|
send_message('% hello world')
|
26
|
+
expect(replies.count).to eq 2
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'does not route unspecified mention names' do
|
30
|
+
send_message('/ hello world')
|
31
|
+
send_message('hello world')
|
32
|
+
expect(replies.count).to eq 0
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'routes configured mention names containing special regex characters' do
|
36
|
+
send_message('.hello world')
|
37
|
+
expect(replies.count).to eq 1
|
11
38
|
end
|
12
39
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lita-message-router
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Taylor Lapeyre
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-03-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lita
|
@@ -134,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
134
|
version: '0'
|
135
135
|
requirements: []
|
136
136
|
rubyforge_project:
|
137
|
-
rubygems_version: 2.
|
137
|
+
rubygems_version: 2.5.1
|
138
138
|
signing_key:
|
139
139
|
specification_version: 4
|
140
140
|
summary: This handler allows you to specify as many 'mention names' as you want for
|