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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6f20f6086ab2a71bf756506e1964a3f96304a5b2
4
- data.tar.gz: effaa5303e6209961d13031bf5ed9398297ef28b
3
+ metadata.gz: 7a91a5d58b6cb3eff3d6e7897f707a8ebdbf0c5b
4
+ data.tar.gz: a3c740337790d324176c8bcf5259d8f205669e64
5
5
  SHA512:
6
- metadata.gz: 31acb6fa3fafd17a10698d669035fa615a79eb560e7ba4bf0be501f4d5341a4f27a62cd6a8d620e795ef7db1a9dc61d360c00fb5986b750ef655b35ee873cba8
7
- data.tar.gz: b3c7d86f03856f53e03d56cf051f516eb1e81be511419917e6fc4e67bf72b5cd5f061cfa3ee5b57a3b0bef5ea56092bcfd16f36f8d622f1580bb2a1c2b2c06c7
6
+ metadata.gz: 51652970e0117a68e31908260f0746474bdcad61cbe1609e4e5f5617cc277fc85748c5d309cc8894d41f023c31127c5b5013248f7b7ad99efe47a5c08f7899ce
7
+ data.tar.gz: b3d12758355cace6f83807782f8463516ef4bed28b3101fd955d72a758985d90350d3c417d7f1fdb87dbdd0ce06c6b18108096c93e051bc799fbba6dddb378ec
data/.gitignore CHANGED
@@ -15,3 +15,4 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ .coveralls.yml
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
- [![Code Climate](https://codeclimate.com/github/sjauld/lita-coffee/badges/gpa.svg)](https://codeclimate.com/github/sjauld/lita-coffee)
13
+ [![Code Climate](https://codeclimate.com/github/sjauld/lita-coffee/badges/gpa.svg)](https://codeclimate.com/github/sjauld/lita-coffee) [![Coverage Status](https://coveralls.io/repos/github/sjauld/lita-coffee/badge.svg?branch=master)](https://coveralls.io/github/sjauld/lita-coffee?branch=master)
14
14
 
15
15
  ## Configuration
16
16
 
@@ -1,6 +1,6 @@
1
1
  module LitaCoffee
2
2
  # lita-coffee version
3
- VERSION = '0.1.3'
3
+ VERSION = '0.1.4'
4
4
  # lita-github version split amongst different revisions
5
5
  MAJOR_VERSION, MINOR_VERSION, REVISION = VERSION.split('.').map(&:to_i)
6
6
  end
@@ -226,17 +226,12 @@ module Lita
226
226
  owing = []
227
227
  owed = []
228
228
  stats.each do |stat|
229
- # owing first
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("Who owes whom?")
113
+ expect(replies.last).to start_with("Coffees to be repaid")
113
114
  end
114
115
 
115
116
  def set_prefs(name,opts={})
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-coffee
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stuart Auld