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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b80a59edf9cf5890d7bad816e5d40de95cd51a5b
|
4
|
+
data.tar.gz: 4f415d09e36bea13380484a32b6a81cd25af001d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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']
|
139
|
+
blues = candidate['evotes']
|
140
140
|
end
|
141
141
|
if candidate['lname'] == 'Trump'
|
142
|
-
reds = candidate['evotes']
|
142
|
+
reds = candidate['evotes']
|
143
143
|
end
|
144
144
|
end
|
145
145
|
|
146
|
-
reply =
|
147
|
-
extras = 54 - blues - reds
|
148
|
-
reply += "\
|
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 += "\
|
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.
|
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("\
|
59
|
+
expect(replies.last).to eq("Clinton 0 |\u000302\u000300-----------------------------------------------------\u000304█| Trump 19")
|
58
60
|
end
|
59
61
|
end
|