cognition 2.0.3 → 2.0.4
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/cognition/matcher.rb +2 -0
- data/lib/cognition/version.rb +1 -1
- data/test/fixtures/hello.rb +1 -1
- data/test/test_default_plugin.rb +2 -2
- data/test/test_helper.rb +1 -1
- data/test/test_matcher.rb +10 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b37fef34af5c88fc16e34dd5855d50d6c214ec4
|
4
|
+
data.tar.gz: aab660a7e21a9324369638de7fd663d39c32efda
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b34e06406f19030648972a5b1fa157b33fde810306d11a948f74ae8f306edb5a99552d06df855387f327b96f49b91ea8464ca1769c0596abbbe7380a8cf1943
|
7
|
+
data.tar.gz: 793bab140adef11717fba95d70d6cc625b6c20ea5f2d89b0628931288d231b8fab91a80892116615300d77a8815b2b5e17ebb946fc0ca4f6fd1710f2ac0747a2
|
data/lib/cognition/matcher.rb
CHANGED
data/lib/cognition/version.rb
CHANGED
data/test/fixtures/hello.rb
CHANGED
data/test/test_default_plugin.rb
CHANGED
@@ -7,12 +7,12 @@ class DefaultPluginTest < Minitest::Test
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def test_returns_help
|
10
|
-
help = "ping - Test if the endpoint is responding. Returns PONG.\nhelp - Lists all commands with help\nhelp <command> - Lists help for <command
|
10
|
+
help = "ping - Test if the endpoint is responding. Returns PONG.\nhelp - Lists all commands with help\nhelp <command> - Lists help for <command>"
|
11
11
|
assert_equal help, @bot.process("help")
|
12
12
|
end
|
13
13
|
|
14
14
|
def test_returns_filtered_help
|
15
|
-
help = "ping - Test if the endpoint is responding. Returns PONG
|
15
|
+
help = "ping - Test if the endpoint is responding. Returns PONG."
|
16
16
|
assert_equal help, @bot.process("help ping")
|
17
17
|
end
|
18
18
|
end
|
data/test/test_helper.rb
CHANGED
data/test/test_matcher.rb
CHANGED
@@ -74,8 +74,18 @@ class MatcherTest < Minitest::Test
|
|
74
74
|
matcher_with_help = Cognition::Matcher.new(/hello\s*(?<name>.*)/, {help: {'hello' => 'says hello'}}, &Proc.new(&method(:dummy_method)))
|
75
75
|
assert_equal ['hello - says hello'], matcher_with_help.help
|
76
76
|
end
|
77
|
+
|
78
|
+
def test_returns_error_if_method_returns_an_error
|
79
|
+
msg = Cognition::Message.new('error')
|
80
|
+
matcher_with_error = Cognition::Matcher.new(/error/, &Proc.new(&method(:error_method)))
|
81
|
+
assert matcher_with_error.attempt(msg).match("'error' found, but raised")
|
82
|
+
end
|
77
83
|
end
|
78
84
|
|
79
85
|
def dummy_method(msg, match_data)
|
80
86
|
"Hello #{match_data['name']}"
|
81
87
|
end
|
88
|
+
|
89
|
+
def error_method(*)
|
90
|
+
foobarcall
|
91
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cognition
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Anderson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|