lita-coffee 0.1.3 → 0.1.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/.gitignore +1 -0
- data/README.md +1 -1
- data/lib/lita-coffee/version.rb +1 -1
- data/lib/lita/handlers/coffee.rb +2 -7
- data/spec/lita/handlers/coffee_spec.rb +2 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a91a5d58b6cb3eff3d6e7897f707a8ebdbf0c5b
|
4
|
+
data.tar.gz: a3c740337790d324176c8bcf5259d8f205669e64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51652970e0117a68e31908260f0746474bdcad61cbe1609e4e5f5617cc277fc85748c5d309cc8894d41f023c31127c5b5013248f7b7ad99efe47a5c08f7899ce
|
7
|
+
data.tar.gz: b3d12758355cace6f83807782f8463516ef4bed28b3101fd955d72a758985d90350d3c417d7f1fdb87dbdd0ce06c6b18108096c93e051bc799fbba6dddb378ec
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -10,7 +10,7 @@ Add lita-coffee to your Lita instance's Gemfile:
|
|
10
10
|
gem "lita-coffee"
|
11
11
|
```
|
12
12
|
|
13
|
-
[](https://codeclimate.com/github/sjauld/lita-coffee)
|
13
|
+
[](https://codeclimate.com/github/sjauld/lita-coffee) [](https://coveralls.io/github/sjauld/lita-coffee?branch=master)
|
14
14
|
|
15
15
|
## Configuration
|
16
16
|
|
data/lib/lita-coffee/version.rb
CHANGED
data/lib/lita/handlers/coffee.rb
CHANGED
@@ -226,17 +226,12 @@ module Lita
|
|
226
226
|
owing = []
|
227
227
|
owed = []
|
228
228
|
stats.each do |stat|
|
229
|
-
|
230
|
-
if stat[1] <= 0
|
231
|
-
owing << stat
|
232
|
-
else
|
233
|
-
owed << stat
|
234
|
-
end
|
229
|
+
stat[1] > 0 ? owed << stat : owing << stat
|
235
230
|
end
|
236
231
|
owing.sort!{|a,b| a[1] <=> b[1]} # Negative for owing, ergo sort in ascending order
|
237
232
|
owed.sort!{|a,b| b[1] <=> a[1]} # Positive for owed, ergo sort in descending order to show who is owed most
|
238
233
|
# Provide a response
|
239
|
-
response.reply("Coffees owed to others\n--\n#{owing.map{|s| "#{s[0]}: #{s[1]}"}.join("\n")}")
|
234
|
+
response.reply("Coffees owed to others\n--\n#{owing.map{|s| "#{s[0]}: #{s[1].abs}"}.join("\n")}")
|
240
235
|
response.reply("Coffees to be repaid\n--\n#{owed.map{|s| "#{s[0]}: #{s[1]}"}.join("\n")}")
|
241
236
|
end
|
242
237
|
|
@@ -27,6 +27,7 @@ describe Lita::Handlers::Coffee, lita_handler: true do
|
|
27
27
|
it { is_expected.to route('coffee -t').to(:system_settings)}
|
28
28
|
it { is_expected.to route('coffee -d').to(:delete_me)}
|
29
29
|
it { is_expected.to route('coffee -l').to(:list_groups)}
|
30
|
+
it { is_expected.to route('coffee -w').to(:show_stats)}
|
30
31
|
|
31
32
|
describe '#coffee' do
|
32
33
|
before{robot.trigger(:loaded)}
|
@@ -109,7 +110,7 @@ describe Lita::Handlers::Coffee, lita_handler: true do
|
|
109
110
|
populate_the_database
|
110
111
|
buy_coffees_for('cool kids')
|
111
112
|
send_message("coffee -w cool kids")
|
112
|
-
expect(replies.last).to start_with("
|
113
|
+
expect(replies.last).to start_with("Coffees to be repaid")
|
113
114
|
end
|
114
115
|
|
115
116
|
def set_prefs(name,opts={})
|