lita-onewheel-karma 0.0.1 → 1.0.0

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: 9c57ec019e5ea0134ddc405c3109a77ef30ca90d
4
- data.tar.gz: d40bc0c2d609fba433aa2e133e346a64c5fcf347
3
+ metadata.gz: 320b223512375e318152ed5fa8ca7307cd87f8a6
4
+ data.tar.gz: 698458f2dbcc2a87025c53c6b5ba73b593909ba3
5
5
  SHA512:
6
- metadata.gz: f45198697fb79a8d19448fa492ce2a059d5b66be936dc8e1e415aa8bb8ec41ce2916097a0aa2d3de0291bed03c63555dd8ded32c8312886078a6ae5b0bd54fa9
7
- data.tar.gz: d4cd7a5f7e88ac4f3204add087e00aad931a3b425115124cde01f94d4aa3273a8132694f4aa99ad956ddd11523b1db3a197d26e7d63bacd4a59e72ed8eb7e971
6
+ metadata.gz: 4a76896356de9997d16b274ec97b2fd4053c0a9d92e3503e498b69b7455199b8f74055495a05327a2fef7eec31dd52472cab634bccce349e70c5434f3f649e1f
7
+ data.tar.gz: dc2e8c694d3bbc062bb402fa8789e30a4d1f33eb0eb8deceec3c16dd58cdb9781cb29b74fecea5c4c683c8eb87befeb0393026d9251237edd4c4e6ba360c03ee
@@ -3,16 +3,16 @@ require 'roman-numerals'
3
3
  module Lita
4
4
  module Handlers
5
5
  class OnewheelKarma < Handler
6
- route /([^\s]+)\s*\+\+(\s|$)/, :add_one_karma,
6
+ route /([^\s]+)\+\+(\s|$)/, :add_one_karma,
7
7
  help: 'object++: Add one karma to [object].'
8
- route /([^\s]+)\s*--(\s|$)/, :remove_one_karma,
8
+ route /([^\s]+)--(\s|$)/, :remove_one_karma,
9
9
  help: 'object++: Remove one karma from [object].'
10
- route /([^\s]+)\s*\*=\s*([-\d]+)/, :multiply_karma,
10
+ route /([^\s]+)\*=\s*([-\d]+)/, :multiply_karma,
11
11
  help: 'object*=n: Multiply karma by n'
12
- route /([^\s]+)\s*\+=\s*([-\d]+)/, :add_arbitrary_karma,
12
+ route /([^\s]+)\+=\s*([-\d]+)/, :add_arbitrary_karma,
13
13
  help: 'object+=n: Add n karma to [object].'
14
- route /([^\s]+)\s*-=\s*([-\d]+)/, :remove_arbitrary_karma,
15
- help: 'object+=n: Remove n karma from [object].'
14
+ route /([^\s]+)-=\s*([-\d]+)/, :remove_arbitrary_karma,
15
+ help: 'object-=n: Remove n karma from [object].'
16
16
 
17
17
  def add_one_karma(response)
18
18
  karma_object = response.matches[0][0]
@@ -48,11 +48,12 @@ module Lita
48
48
  end
49
49
 
50
50
  def reply_with_karma(karma_object, karma)
51
- if karma >= 0
51
+ # if karma >= 0
52
52
  "#{karma_object} has #{karma} karma!"
53
- else
54
- "#{karma_object} has #{RomanNumerals.to_roman(karma * -1)}💩 karma!"
55
- end
53
+ # else
54
+ # "#{karma_object} has #{RomanNumerals.to_roman(karma * -1)}💩 karma!"
55
+ # "#{karma_object} has #{RomanNumerals.to_roman(karma * -1)}💩 karma!"
56
+ # end
56
57
  end
57
58
 
58
59
  # Find the karma object from redis and increment appropriately.
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'lita-onewheel-karma'
3
- spec.version = '0.0.1'
3
+ spec.version = '1.0.0'
4
4
  spec.authors = ['Andrew Kreps']
5
5
  spec.email = ['andrew.kreps@gmail.com']
6
6
  spec.description = 'Karma with a maths-focused twist.'
@@ -2,7 +2,8 @@ require 'spec_helper'
2
2
 
3
3
  describe Lita::Handlers::OnewheelKarma, lita_handler: true do
4
4
  def get_negative(num)
5
- "a has #{RomanNumerals.to_roman(num)}💩 karma!"
5
+ # "a has #{RomanNumerals.to_roman(num)}💩 karma!"
6
+ "a has -#{num} karma!"
6
7
  end
7
8
 
8
9
  def get_positive(num)
@@ -83,22 +84,22 @@ describe Lita::Handlers::OnewheelKarma, lita_handler: true do
83
84
  end
84
85
 
85
86
  it 'will spacing' do
86
- send_message 'a -= -9'
87
+ send_message 'a-= -9'
87
88
  expect(replies.last).to eq get_positive(9)
88
89
  end
89
90
 
90
91
  it 'will spacing 2' do
91
- send_message 'a += -9'
92
+ send_message 'a+= -9'
92
93
  expect(replies.last).to eq get_negative(9)
93
94
  end
94
95
 
95
96
  it 'will spacing 3' do
96
- send_message 'a ++'
97
+ send_message 'a++'
97
98
  expect(replies.last).to eq get_positive(1)
98
99
  end
99
100
 
100
101
  it 'will spacing 4' do
101
- send_message 'a --'
102
+ send_message 'a--'
102
103
  expect(replies.last).to eq get_negative(1)
103
104
  end
104
105
 
@@ -127,6 +128,11 @@ describe Lita::Handlers::OnewheelKarma, lita_handler: true do
127
128
  send_message 'a--'
128
129
  send_message 'a--'
129
130
  send_message 'a--'
130
- expect(replies.last).to include 'a has IV'
131
+ expect(replies.last).to include 'a has -4'
132
+ end
133
+
134
+ it 'will not space' do
135
+ send_message 'a ++'
136
+ expect(replies.last).to eq nil
131
137
  end
132
138
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-onewheel-karma
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kreps
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-25 00:00:00.000000000 Z
11
+ date: 2015-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lita