lita-onewheel-election-cnn 3.4.1 → 3.4.2

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: 8f70def94f17ed66fbd01444e254c180576b0241
4
- data.tar.gz: 9ded1bfca27f1683b1cefaa4b96d8c9b2a32f550
3
+ metadata.gz: b80a59edf9cf5890d7bad816e5d40de95cd51a5b
4
+ data.tar.gz: 4f415d09e36bea13380484a32b6a81cd25af001d
5
5
  SHA512:
6
- metadata.gz: 446aeb426aa369d006e2ece3a2fb23230bef5c82e6738392b656f2fffd6836f410abc1012b0a02dcfe7c7aa130051f1637e41b5b28d47dbe887a0a477a0668bd
7
- data.tar.gz: 360668570d49f4264e279f6b78bcc1b13664173cef14bdc312d9ea866e54e0fb602ee40a86b86f38b874fa2ba94d740182f35ab0d4db4a6866eb424660bdfc8f
6
+ metadata.gz: b9ef1cb8fe3e760f43ba54335b50c97e35f338e20a865e5fd22c987138a94d4e747b35abc150841b4a72fa629f0bd5d393e2da81fc4d992a5617ea8ea2343472
7
+ data.tar.gz: 71fb845655a18cd33635b0dd5efcd1c1888d577fee34c6ff1a1edfef5093ea03dc9b3008f7955bb5d7ef45988a0b50e741b08c78d91ec5720bffaab5cd72d5db
@@ -136,21 +136,22 @@ module Lita
136
136
  blues = 0
137
137
  results['candidates'].each do |candidate|
138
138
  if candidate['lname'] == 'Clinton'
139
- blues = candidate['evotes'] / 10
139
+ blues = candidate['evotes']
140
140
  end
141
141
  if candidate['lname'] == 'Trump'
142
- reds = candidate['evotes'] / 10
142
+ reds = candidate['evotes']
143
143
  end
144
144
  end
145
145
 
146
- reply = ''
147
- extras = 54 - blues - reds
148
- reply += "\x0304"
149
- blues.times { reply += '█' }
146
+ reply = "Clinton #{blues} |"
147
+ extras = 54 - (blues / 10) - (reds / 10)
148
+ reply += "\x0302"
149
+ (blues / 10).times { reply += '█' }
150
150
  reply += "\x0300"
151
151
  extras.times { reply += '-'}
152
- reply += "\x0302"
153
- reds.times { reply += '█' }
152
+ reply += "\x0304"
153
+ (reds / 10).times { reply += '█' }
154
+ reply += "| Trump #{reds}"
154
155
 
155
156
  response.reply reply
156
157
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'lita-onewheel-election-cnn'
3
- spec.version = '3.4.1'
3
+ spec.version = '3.4.2'
4
4
  spec.authors = ['Andrew Kreps']
5
5
  spec.email = ['andrew.kreps@gmail.com']
6
6
  spec.description = %q{Lita interface to CNN's 2016 Presidential Election JSON.}
@@ -53,7 +53,9 @@ describe Lita::Handlers::OnewheelElectionCnn, lita_handler: true do
53
53
  end
54
54
 
55
55
  it 'ansis' do
56
+ mock = File.open('spec/fixtures/election.json').read
57
+ allow(RestClient).to receive(:get) { mock }
56
58
  send_command 'ansielection'
57
- expect(replies.last).to eq("\x0304-------------\x0300-------------------------\x0302----------------")
59
+ expect(replies.last).to eq("Clinton 0 |\u000302\u000300-----------------------------------------------------\u000304█| Trump 19")
58
60
  end
59
61
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-onewheel-election-cnn
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.1
4
+ version: 3.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kreps