cognition 2.0.7 → 2.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a63aca73212e0d623810b4dd6fb6d67477ae3198
4
- data.tar.gz: 05344add79e3940e0b271d7912f60b6bb297af7d
3
+ metadata.gz: 32aec8b43747dc3d4e93dde52b11976060dee440
4
+ data.tar.gz: 29694fbdf558c9599f7867d14985ccd05e50bce0
5
5
  SHA512:
6
- metadata.gz: 0511ff06d697e59a5c8b763d4fe5715ba54dbd8d57a7db5d71a0e47a1668be8c442ab3587998e0b240cb93e8afdf25c32a340e5e23963c48ae591bb520828436
7
- data.tar.gz: a104d853ce50611cafa39bc86b215d98ea92f38e5ea53531edfec931a0deb0d7b18e905eb16816f33718dce2bc0dd013c6a0e62d270bbdd1de29ec2f242c6f96
6
+ metadata.gz: f14281cbedf9470605b6fcf454b1f862c5f0e0a58297a0afa6e16f7279a04ffafdbfa71824a8963d6c0bd8ba900bbfc0c90513238c837107e3e6678886569e59
7
+ data.tar.gz: b6bae92cad86c46c055d33ef13ca60f67f6159c8628d4710e195ae0f73e10db90510b5fada35a6d820c3aaaa313d4e3a200e95b3ecf172d39e1c23a2a1d3dc99
@@ -2,7 +2,7 @@ module Cognition
2
2
  module Plugins
3
3
  class Default < Cognition::Plugins::Base
4
4
  # rubocop:disable Lint/AmbiguousRegexpLiteral
5
- match /^ping/i, :pong, help: {
5
+ match /^ping$/i, :pong, help: {
6
6
  "ping" => "Test if the endpoint is responding. Returns PONG."
7
7
  }
8
8
 
@@ -1,3 +1,3 @@
1
1
  module Cognition
2
- VERSION = "2.0.7"
2
+ VERSION = "2.0.8"
3
3
  end
@@ -0,0 +1,12 @@
1
+ require "tilt/haml"
2
+ require "tilt/erb"
3
+ require "haml"
4
+ class Anchor < Cognition::Plugins::Base
5
+ match "ping me", :anchored_ping, help: {
6
+ "ping me" => "Returns 'OK'"
7
+ }
8
+
9
+ def anchored_ping(*)
10
+ "OK"
11
+ end
12
+ end
@@ -1,6 +1,7 @@
1
1
  require "minitest/autorun"
2
2
  require "cognition"
3
3
  require_relative "fixtures/hello"
4
+ require_relative "fixtures/anchor"
4
5
 
5
6
  class CognitionTest < Minitest::Test
6
7
  def setup
@@ -39,4 +40,10 @@ class CognitionTest < Minitest::Test
39
40
  output = @bot.process(msg)
40
41
  assert_match "No such command: pong\nUse 'help' for available commands!", output
41
42
  end
43
+
44
+ def test_anchored_ping
45
+ @bot.register(Anchor)
46
+
47
+ assert_equal 'OK', @bot.process("ping me")
48
+ end
42
49
  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.7
4
+ version: 2.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Anderson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-05 00:00:00.000000000 Z
11
+ date: 2016-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -135,6 +135,7 @@ files:
135
135
  - lib/cognition/plugins/default.rb
136
136
  - lib/cognition/responder.rb
137
137
  - lib/cognition/version.rb
138
+ - test/fixtures/anchor.rb
138
139
  - test/fixtures/hello.rb
139
140
  - test/fixtures/hello/views/bonjour.text.erb
140
141
  - test/fixtures/hello/views/hey.html.haml
@@ -168,11 +169,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
168
169
  version: '0'
169
170
  requirements: []
170
171
  rubyforge_project:
171
- rubygems_version: 2.4.8
172
+ rubygems_version: 2.5.1
172
173
  signing_key:
173
174
  specification_version: 4
174
175
  summary: A rules engine for running commands.
175
176
  test_files:
177
+ - test/fixtures/anchor.rb
176
178
  - test/fixtures/hello.rb
177
179
  - test/fixtures/hello/views/bonjour.text.erb
178
180
  - test/fixtures/hello/views/hey.html.haml