lita-onewheel-forecast-io 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -2
- data/lib/lita/handlers/utils.rb +0 -1
- data/lita-onewheel-forecast-io.gemspec +1 -1
- data/spec/{heavy_rain.json → fixtures/heavy_rain.json} +0 -0
- data/spec/{mock_weather.json → fixtures/mock_weather.json} +0 -0
- data/spec/{mock_weather_no_minute.json → fixtures/mock_weather_no_minute.json} +0 -0
- data/spec/{mock_weather_with_snow.json → fixtures/mock_weather_with_snow.json} +0 -0
- data/spec/lita/handlers/forecast_io_spec.rb +107 -10
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70b7126a7946d01d175e892d4c42b787295e3470
|
4
|
+
data.tar.gz: d132294f0bc8099f5d491aba5987989c3a5dcd86
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cdab3101b2778eb752cdeccfc931773df5aca8ae964a3fdd080025a45717202c367a9693aa7b3576bbffaf4986c304f554e2875dc0aa524f69170e7dc67da86c
|
7
|
+
data.tar.gz: fbeeba47475ae7d8a5261271774a0011f14522fee249f69839f820ed9ca3abee37f3d7dbd3d14e4b8cc802964f691be2fc5ccb5625009e9fcb96e06c8887f03d
|
data/.travis.yml
CHANGED
data/lib/lita/handlers/utils.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -4,12 +4,109 @@ require 'geocoder'
|
|
4
4
|
describe Lita::Handlers::OnewheelForecastIo, lita_handler: true do
|
5
5
|
|
6
6
|
before(:each) do
|
7
|
-
mock_geocoder = ::Geocoder::Result::Google.new({'formatted_address' => 'Portland, OR', 'geometry' => { 'location' => { 'lat' => 45.523452, 'lng' => -122.676207 }}})
|
8
|
-
allow(::Geocoder).to receive(:search) { [mock_geocoder] } # It expects an array of geocoder objects.
|
7
|
+
# mock_geocoder = ::Geocoder::Result::Google.new({'formatted_address' => 'Portland, OR', 'geometry' => { 'location' => { 'lat' => 45.523452, 'lng' => -122.676207 }}})
|
8
|
+
# allow(::Geocoder).to receive(:search) { [mock_geocoder] } # It expects an array of geocoder objects.
|
9
|
+
Geocoder.configure(:lookup => :test)
|
10
|
+
|
11
|
+
Geocoder::Lookup::Test.add_stub(
|
12
|
+
'Portland, OR', [
|
13
|
+
{
|
14
|
+
'formatted_address' => 'Portland, OR, USA',
|
15
|
+
|
16
|
+
'geometry' => {
|
17
|
+
'location' => {
|
18
|
+
'lat' => 45.523452,
|
19
|
+
'lng' => -122.676207,
|
20
|
+
'address' => 'Portland, OR, USA',
|
21
|
+
'state' => 'Oregon',
|
22
|
+
'state_code' => 'OR',
|
23
|
+
'country' => 'United States',
|
24
|
+
'country_code' => 'US'
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
28
|
+
]
|
29
|
+
)
|
30
|
+
|
31
|
+
Geocoder::Lookup::Test.add_stub(
|
32
|
+
'Portland', [
|
33
|
+
{
|
34
|
+
'formatted_address' => 'Portland, OR, USA',
|
35
|
+
'geometry' => {
|
36
|
+
'location' => {
|
37
|
+
'lat' => 45.523452,
|
38
|
+
'lng' => -122.676207,
|
39
|
+
'address' => 'Portland, OR, USA',
|
40
|
+
'state' => 'Oregon',
|
41
|
+
'state_code' => 'OR',
|
42
|
+
'country' => 'United States',
|
43
|
+
'country_code' => 'US'
|
44
|
+
}
|
45
|
+
}
|
46
|
+
}
|
47
|
+
]
|
48
|
+
)
|
49
|
+
|
50
|
+
Geocoder::Lookup::Test.add_stub(
|
51
|
+
'portland', [
|
52
|
+
{
|
53
|
+
'formatted_address' => 'Portland, OR, USA',
|
54
|
+
'geometry' => {
|
55
|
+
'location' => {
|
56
|
+
'lat' => 45.523452,
|
57
|
+
'lng' => -122.676207,
|
58
|
+
'address' => 'Portland, OR, USA',
|
59
|
+
'state' => 'Oregon',
|
60
|
+
'state_code' => 'OR',
|
61
|
+
'country' => 'United States',
|
62
|
+
'country_code' => 'US'
|
63
|
+
}
|
64
|
+
}
|
65
|
+
}
|
66
|
+
]
|
67
|
+
)
|
68
|
+
|
69
|
+
Geocoder::Lookup::Test.add_stub(
|
70
|
+
'Paris, france', [
|
71
|
+
{
|
72
|
+
'formatted_address' => 'Paris, FR',
|
73
|
+
'geometry' => {
|
74
|
+
'location' => {
|
75
|
+
'lat' => 48.856614,
|
76
|
+
'lng' => 2.3522219,
|
77
|
+
'address' => 'Paris, FR',
|
78
|
+
'state' => 'm',
|
79
|
+
'state_code' => 'm',
|
80
|
+
'country' => 'France',
|
81
|
+
'country_code' => 'FR'
|
82
|
+
}
|
83
|
+
}
|
84
|
+
}
|
85
|
+
]
|
86
|
+
)
|
87
|
+
|
88
|
+
Geocoder::Lookup::Test.add_stub(
|
89
|
+
'Paris', [
|
90
|
+
{
|
91
|
+
'formatted_address' => 'Paris, FR',
|
92
|
+
'geometry' => {
|
93
|
+
'location' => {
|
94
|
+
'lat' => 48.856614,
|
95
|
+
'lng' => 2.3522219,
|
96
|
+
'address' => 'Paris, FR',
|
97
|
+
'state' => 'm',
|
98
|
+
'state_code' => 'm',
|
99
|
+
'country' => 'France',
|
100
|
+
'country_code' => 'FR'
|
101
|
+
}
|
102
|
+
}
|
103
|
+
}
|
104
|
+
]
|
105
|
+
)
|
9
106
|
|
10
107
|
# Mock up the ForecastAPI call.
|
11
108
|
# Todo: add some other mocks to allow more edgy testing (rain percentages, !rain eightball replies, etc
|
12
|
-
mock_weather_json = File.open(
|
109
|
+
mock_weather_json = File.open('spec/fixtures/mock_weather.json').read
|
13
110
|
allow(RestClient).to receive(:get) { mock_weather_json }
|
14
111
|
|
15
112
|
registry.configure do |config|
|
@@ -140,13 +237,13 @@ describe Lita::Handlers::OnewheelForecastIo, lita_handler: true do
|
|
140
237
|
end
|
141
238
|
|
142
239
|
it '!ansirain no minutes' do
|
143
|
-
allow(RestClient).to receive(:get) { File.open('spec/mock_weather_no_minute.json').read }
|
240
|
+
allow(RestClient).to receive(:get) { File.open('spec/fixtures/mock_weather_no_minute.json').read }
|
144
241
|
send_command 'ansirain'
|
145
242
|
expect(replies.last).to include('|No minute-by-minute data available.|')
|
146
243
|
end
|
147
244
|
|
148
245
|
it '!ansiintensity no minutes' do
|
149
|
-
allow(RestClient).to receive(:get) { File.open('spec/mock_weather_no_minute.json').read }
|
246
|
+
allow(RestClient).to receive(:get) { File.open('spec/fixtures/mock_weather_no_minute.json').read }
|
150
247
|
send_command 'ansiintensity'
|
151
248
|
expect(replies.last).to include('|No minute-by-minute data available.|')
|
152
249
|
end
|
@@ -163,22 +260,22 @@ describe Lita::Handlers::OnewheelForecastIo, lita_handler: true do
|
|
163
260
|
|
164
261
|
it '!ansitemp portland' do
|
165
262
|
send_command 'ansitemp portland'
|
166
|
-
expect(replies.last).to eq("Portland, OR 24 hr temps: 28.3°F |\u000306_▁▃\u000310▅▇█\u000303██\u000310██▇▅\u000306▅▃▃▃▃▃▃▁▁▁▁\u0003| 28.4°F Range: 28.3°F - 39.0°F")
|
263
|
+
expect(replies.last).to eq("Portland, OR, USA 24 hr temps: 28.3°F |\u000306_▁▃\u000310▅▇█\u000303██\u000310██▇▅\u000306▅▃▃▃▃▃▃▁▁▁▁\u0003| 28.4°F Range: 28.3°F - 39.0°F")
|
167
264
|
end
|
168
265
|
|
169
266
|
it '!ieeetemp portland' do
|
170
267
|
send_command 'ieeetemp portland'
|
171
|
-
expect(replies.last).to eq("Portland, OR 24 hr temps: 271.09K |\u000306_▁▃\u000310▅▇█\u000303██\u000310██▇▅\u000306▅▃▃▃▃▃▃▁▁▁▁\u0003| 271.15K Range: 271.09K - 277.04K")
|
268
|
+
expect(replies.last).to eq("Portland, OR, USA 24 hr temps: 271.09K |\u000306_▁▃\u000310▅▇█\u000303██\u000310██▇▅\u000306▅▃▃▃▃▃▃▁▁▁▁\u0003| 271.15K Range: 271.09K - 277.04K")
|
172
269
|
end
|
173
270
|
|
174
271
|
it '!dailytemp portland' do
|
175
272
|
send_command 'dailytemp portland'
|
176
|
-
expect(replies.last).to eq("Portland, OR 48 hr temps: 28.3°F |\u000306_▁▃\u000310▅▅▇\u000303██\u000310▇▇▅▅\u000306▅▃▃▃▃▃▁▁▁▁▁▁▁▃\u000310▅▅▇\u000303█████▇\u000310▇▇▇▅▅▅▅\u000306▅▃▃▃▃\u0003| 30.5°F Range: 28.3°F - 41.3°F")
|
273
|
+
expect(replies.last).to eq("Portland, OR, USA 48 hr temps: 28.3°F |\u000306_▁▃\u000310▅▅▇\u000303██\u000310▇▇▅▅\u000306▅▃▃▃▃▃▁▁▁▁▁▁▁▃\u000310▅▅▇\u000303█████▇\u000310▇▇▇▅▅▅▅\u000306▅▃▃▃▃\u0003| 30.5°F Range: 28.3°F - 41.3°F")
|
177
274
|
end
|
178
275
|
|
179
276
|
it '!ansiwind portland' do
|
180
277
|
send_command 'ansiwind portland'
|
181
|
-
expect(replies.last).to eq("Portland, OR 48h wind direction 4.3 mph|\u000306↓\u000310↙←\u000311↖↑↗\u000308→↘\u000311↓←←←←←←\u000310←←←←←←←\u000306←←←←←\u000302←←←↙↙↙↙↓↓↓\u000306↓↓↓↓↓↓↓↓↙↙\u0003|4.18 mph Range: 1.39 mph - 12.71 mph")
|
278
|
+
expect(replies.last).to eq("Portland, OR, USA 48h wind direction 4.3 mph|\u000306↓\u000310↙←\u000311↖↑↗\u000308→↘\u000311↓←←←←←←\u000310←←←←←←←\u000306←←←←←\u000302←←←↙↙↙↙↓↓↓\u000306↓↓↓↓↓↓↓↓↙↙\u0003|4.18 mph Range: 1.39 mph - 12.71 mph")
|
182
279
|
end
|
183
280
|
|
184
281
|
it '!conditions' do
|
@@ -376,7 +473,7 @@ describe Lita::Handlers::OnewheelForecastIo, lita_handler: true do
|
|
376
473
|
|
377
474
|
it '!geo' do
|
378
475
|
send_command 'geo Paris, france'
|
379
|
-
expect(replies.last).to eq('
|
476
|
+
expect(replies.last).to eq('48.856614, 2.3522219')
|
380
477
|
end
|
381
478
|
|
382
479
|
it '!neareststorm' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lita-onewheel-forecast-io
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kreps
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lita
|
@@ -191,11 +191,11 @@ files:
|
|
191
191
|
- lita-onewheel-forecast-io.gemspec
|
192
192
|
- lita_config_sample.rb
|
193
193
|
- locales/en.yml
|
194
|
-
- spec/heavy_rain.json
|
194
|
+
- spec/fixtures/heavy_rain.json
|
195
|
+
- spec/fixtures/mock_weather.json
|
196
|
+
- spec/fixtures/mock_weather_no_minute.json
|
197
|
+
- spec/fixtures/mock_weather_with_snow.json
|
195
198
|
- spec/lita/handlers/forecast_io_spec.rb
|
196
|
-
- spec/mock_weather.json
|
197
|
-
- spec/mock_weather_no_minute.json
|
198
|
-
- spec/mock_weather_with_snow.json
|
199
199
|
- spec/spec_helper.rb
|
200
200
|
homepage: https://github.com/onewheelskyward/lita-onewheel-forecast-io
|
201
201
|
licenses:
|
@@ -223,9 +223,9 @@ signing_key:
|
|
223
223
|
specification_version: 4
|
224
224
|
summary: A text-based interactive query engine for http://forecast.io's api.
|
225
225
|
test_files:
|
226
|
-
- spec/heavy_rain.json
|
226
|
+
- spec/fixtures/heavy_rain.json
|
227
|
+
- spec/fixtures/mock_weather.json
|
228
|
+
- spec/fixtures/mock_weather_no_minute.json
|
229
|
+
- spec/fixtures/mock_weather_with_snow.json
|
227
230
|
- spec/lita/handlers/forecast_io_spec.rb
|
228
|
-
- spec/mock_weather.json
|
229
|
-
- spec/mock_weather_no_minute.json
|
230
|
-
- spec/mock_weather_with_snow.json
|
231
231
|
- spec/spec_helper.rb
|