lita-onewheel-election-cnn 2.0.0 → 3.0.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: 30c1898cee0d74d869a5e8d86c48fdf1fca41332
|
4
|
+
data.tar.gz: 428326960b2d5eb2bbf537605fb79492cae926d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c397ead8761546a44341bd7b1b780020fb43b54b4a8474989ea5f068cf85ce06a38b7cb0569cf1b1b57186f3ebd0fbcdb87db50b8657225d1e18234ce5664a24
|
7
|
+
data.tar.gz: 1588204b29a442effaf07966d39df58355f4743e35708a8f9310447ef680974ec219c6ddbb6bf808e6a3f4b641e0266c41aece56f6a6b15725f24f2c5c508c90
|
@@ -33,8 +33,9 @@ module Lita
|
|
33
33
|
|
34
34
|
results['races'].each do |race|
|
35
35
|
if race['state'].downcase == state.downcase
|
36
|
+
response.reply "#{state}, #{race['evotes']} electoral votes, #{race['pctsrep']}% reporting"
|
36
37
|
race['candidates'].each do |candidate|
|
37
|
-
candidate_str = "#{
|
38
|
+
candidate_str = "#{candidate['fname']} #{candidate['lname']}: "
|
38
39
|
candidate_str += "#{candidate['pctDecimal']}%"
|
39
40
|
candidate_str += " WINNER! #{candidate['evotes']} electoral votes." if candidate['winner']
|
40
41
|
response.reply candidate_str
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = 'lita-onewheel-election-cnn'
|
3
|
-
spec.version = '
|
3
|
+
spec.version = '3.0.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.}
|
@@ -23,23 +23,26 @@ describe Lita::Handlers::OnewheelElectionCnn, lita_handler: true do
|
|
23
23
|
mock = File.open('spec/fixtures/election.json').read
|
24
24
|
allow(RestClient).to receive(:get) { mock }
|
25
25
|
send_command 'election va'
|
26
|
-
expect(replies[0]).to eq("Virginia
|
27
|
-
expect(replies[1]).to eq("
|
26
|
+
expect(replies[0]).to eq("Virginia, 13 electoral votes, 0% reporting")
|
27
|
+
expect(replies[1]).to eq("Hillary Clinton: 0.0%")
|
28
|
+
expect(replies[2]).to eq("Donald Trump: 0.0%")
|
28
29
|
end
|
29
30
|
|
30
31
|
it 'shows by STATE' do
|
31
32
|
mock = File.open('spec/fixtures/election.json').read
|
32
33
|
allow(RestClient).to receive(:get) { mock }
|
33
34
|
send_command 'election VA'
|
34
|
-
expect(replies[0]).to eq("Virginia
|
35
|
-
expect(replies[1]).to eq("
|
35
|
+
expect(replies[0]).to eq("Virginia, 13 electoral votes, 0% reporting")
|
36
|
+
expect(replies[1]).to eq("Hillary Clinton: 0.0%")
|
37
|
+
expect(replies[2]).to eq("Donald Trump: 0.0%")
|
36
38
|
end
|
37
39
|
|
38
40
|
it 'shows by full state name downcase' do
|
39
41
|
mock = File.open('spec/fixtures/election.json').read
|
40
42
|
allow(RestClient).to receive(:get) { mock }
|
41
43
|
send_command 'election new york'
|
42
|
-
expect(replies[0]).to eq("NEW YORK
|
43
|
-
expect(replies[1]).to eq("
|
44
|
+
expect(replies[0]).to eq("NEW YORK, 29 electoral votes, 0% reporting")
|
45
|
+
expect(replies[1]).to eq("Hillary Clinton: 0.0%")
|
46
|
+
expect(replies[2]).to eq("Donald Trump: 0.0%")
|
44
47
|
end
|
45
48
|
end
|