lita-onewheel-election-cnn 3.0.2 → 3.1.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80a14d04e9bb68796e73c74a2af75d1e27d2cd3c
|
4
|
+
data.tar.gz: ca4c6d08d13667bfe89e1816649f781865e0c659
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb0b45260df8748c39dd88c0303e49b1600994197cb15b5b19dd02fb74a82db6e0b0a48f2bc7056098c64d62d2350f3683d278860c2377962aca09be47b9ecf4
|
7
|
+
data.tar.gz: 0e222f45c90a56e845bc37dbd3582ac46acaae3b54b6989628775fe940164e5f58f02ebe5a20704ac97ee02b6cf523d2d65def2f1f59c799b703b4b64a50dad6
|
@@ -27,8 +27,8 @@ module Lita
|
|
27
27
|
|
28
28
|
results['candidates'].each do |candidate|
|
29
29
|
candidate_str = "#{candidate['fname']} #{candidate['lname']}: "
|
30
|
-
candidate_str += "#{candidate['pctDecimal']}
|
31
|
-
candidate_str += "
|
30
|
+
candidate_str += "#{candidate['pctDecimal']}%, #{candidate['evotes']} electoral votes."
|
31
|
+
candidate_str += " WINNER! " if candidate['winner']
|
32
32
|
Lita.logger.debug "Replying with #{candidate_str}"
|
33
33
|
response.reply candidate_str
|
34
34
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = 'lita-onewheel-election-cnn'
|
3
|
-
spec.version = '3.0
|
3
|
+
spec.version = '3.1.0'
|
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.}
|
data/spec/fixtures/election.json
CHANGED
@@ -10,16 +10,16 @@ describe Lita::Handlers::OnewheelElectionCnn, lita_handler: true do
|
|
10
10
|
mock = File.open('spec/fixtures/election.json').read
|
11
11
|
allow(RestClient).to receive(:get) { mock }
|
12
12
|
send_command 'election'
|
13
|
-
expect(replies[0]).to eq("Hillary Clinton: 0.0
|
14
|
-
expect(replies[1]).to eq("Donald Trump: 0.0
|
13
|
+
expect(replies[0]).to eq("Hillary Clinton: 0.0%, 0 electoral votes.")
|
14
|
+
expect(replies[1]).to eq("Donald Trump: 0.0%, 19 electoral votes.")
|
15
15
|
end
|
16
16
|
|
17
17
|
it 'shows a winner' do
|
18
18
|
mock = File.open('spec/fixtures/winner.json').read
|
19
19
|
allow(RestClient).to receive(:get) { mock }
|
20
20
|
send_command 'election'
|
21
|
-
expect(replies[0]).to eq("Hillary Clinton: 0.0
|
22
|
-
expect(replies[1]).to eq("Donald Trump: 0.0
|
21
|
+
expect(replies[0]).to eq("Hillary Clinton: 0.0%, 0 electoral votes. WINNER! ")
|
22
|
+
expect(replies[1]).to eq("Donald Trump: 0.0%, 0 electoral votes.")
|
23
23
|
end
|
24
24
|
|
25
25
|
it 'shows by state' do
|