barometer 0.6.4 → 0.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +1 -1
- data/VERSION.yml +1 -1
- data/barometer.gemspec +9 -2
- data/bin/barometer +1 -1
- data/lib/barometer/data/geo.rb +12 -1
- data/lib/barometer/formats/coordinates.rb +1 -1
- data/lib/barometer/query.rb +1 -1
- data/spec/barometer_spec.rb +13 -6
- data/spec/data/distance_spec.rb +1 -1
- data/spec/data/geo_spec.rb +1 -1
- data/spec/data/local_datetime_spec.rb +1 -1
- data/spec/data/local_time_spec.rb +1 -1
- data/spec/data/location_spec.rb +1 -1
- data/spec/data/pressure_spec.rb +1 -1
- data/spec/data/speed_spec.rb +1 -1
- data/spec/data/sun_spec.rb +1 -1
- data/spec/data/temperature_spec.rb +1 -1
- data/spec/data/units_spec.rb +1 -1
- data/spec/data/zone_spec.rb +2 -2
- data/spec/fixtures/geocode/40_73.json +173 -0
- data/spec/fixtures/geocode/90210.json +41 -0
- data/spec/fixtures/geocode/T5B4M9.json +35 -0
- data/spec/fixtures/geocode/atlanta.json +38 -0
- data/spec/fixtures/geocode/calgary_ab.json +38 -0
- data/spec/fixtures/geocode/ksfo.json +42 -0
- data/spec/fixtures/geocode/newyork_ny.json +38 -0
- data/spec/formats/coordinates_spec.rb +31 -31
- data/spec/formats/format_spec.rb +1 -1
- data/spec/formats/geocode_spec.rb +2 -2
- data/spec/formats/icao_spec.rb +1 -1
- data/spec/formats/postalcode_spec.rb +1 -1
- data/spec/formats/short_zipcode_spec.rb +1 -1
- data/spec/formats/weather_id_spec.rb +1 -1
- data/spec/formats/zipcode_spec.rb +1 -1
- data/spec/measurements/measurement_spec.rb +14 -14
- data/spec/measurements/result_array_spec.rb +1 -1
- data/spec/measurements/result_spec.rb +1 -1
- data/spec/query_spec.rb +3 -3
- data/spec/spec_helper.rb +31 -52
- data/spec/weather_services/google_spec.rb +4 -4
- data/spec/weather_services/services_spec.rb +2 -2
- data/spec/weather_services/weather_bug_spec.rb +6 -6
- data/spec/weather_services/weather_dot_com_spec.rb +3 -3
- data/spec/weather_services/wunderground_spec.rb +5 -5
- data/spec/weather_services/yahoo_spec.rb +3 -3
- data/spec/weather_spec.rb +15 -15
- data/spec/web_services/geocode_spec.rb +1 -1
- data/spec/web_services/web_services_spec.rb +1 -1
- metadata +9 -2
data/spec/query_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'spec_helper'
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
2
|
|
3
3
|
describe "Query" do
|
4
4
|
|
@@ -17,12 +17,12 @@ describe "Query" do
|
|
17
17
|
@zipcode_to_geocode = "Beverly Hills, CA, USA"
|
18
18
|
@zipcode_to_weather_id = "USCA0090"
|
19
19
|
@postalcode_to_coordinates = "53.570447,-113.456083"
|
20
|
-
@geocode_to_coordinates = "40.
|
20
|
+
@geocode_to_coordinates = "40.7142691,-74.0059729"
|
21
21
|
@geocode_to_weather_id = "USNY0996"
|
22
22
|
@coordinates_to_geocode = "New York, NY, USA"
|
23
23
|
@coordinates_to_weather_id = "USNY0996"
|
24
24
|
@icao_to_coordinates = "37.615223,-122.389979"
|
25
|
-
@icao_to_geocode = "
|
25
|
+
@icao_to_geocode = "Millbrae, CA, USA"
|
26
26
|
@icao_to_weather_id = "USCA0987"
|
27
27
|
|
28
28
|
Barometer.google_geocode_key = nil
|
data/spec/spec_helper.rb
CHANGED
@@ -5,8 +5,9 @@ require 'fakeweb'
|
|
5
5
|
require 'cgi'
|
6
6
|
require 'yaml'
|
7
7
|
|
8
|
-
|
9
|
-
|
8
|
+
#$LOAD_PATH.unshift(File.dirname(__FILE__))
|
9
|
+
#$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
10
|
+
$:.unshift((File.join(File.dirname(__FILE__), '..', 'lib')))
|
10
11
|
require 'barometer'
|
11
12
|
|
12
13
|
FakeWeb.allow_net_connect = false
|
@@ -48,73 +49,51 @@ end
|
|
48
49
|
#
|
49
50
|
geo_url = "http://maps.google.com/maps/geo?"
|
50
51
|
FakeWeb.register_uri(:get,
|
51
|
-
"#{geo_url}gl=US&q=90210&output=
|
52
|
-
:
|
52
|
+
"#{geo_url}gl=US&key=#{KEY}&sensor=false&q=90210&output=json",
|
53
|
+
:body => File.read(File.join(File.dirname(__FILE__),
|
53
54
|
'fixtures/geocode',
|
54
|
-
'90210.
|
55
|
+
'90210.json')
|
55
56
|
)
|
56
57
|
)
|
57
58
|
FakeWeb.register_uri(:get,
|
58
|
-
"#{geo_url}gl=&q=#{CGI.escape("40.756054,-73.986951")}&output=
|
59
|
-
:
|
59
|
+
"#{geo_url}gl=&q=#{CGI.escape("40.756054,-73.986951")}&output=json&key=#{KEY}&sensor=false",
|
60
|
+
:body => File.read(File.join(File.dirname(__FILE__),
|
60
61
|
'fixtures/geocode',
|
61
|
-
'40_73.
|
62
|
+
'40_73.json')
|
62
63
|
)
|
63
64
|
)
|
64
65
|
|
65
|
-
# FakeWeb.register_uri(:get,
|
66
|
-
# "#{geo_url}gl=&q=90210&output=xml&key=#{KEY}",
|
67
|
-
# :string => File.read(File.join(File.dirname(__FILE__),
|
68
|
-
# 'fixtures/geocode',
|
69
|
-
# '90210.xml')
|
70
|
-
# )
|
71
|
-
# )
|
72
|
-
FakeWeb.register_uri(:get,
|
73
|
-
"#{geo_url}gl=&q=New%20York%2C%20NY&output=xml&key=#{KEY}",
|
74
|
-
:string => File.read(File.join(File.dirname(__FILE__),
|
75
|
-
'fixtures/geocode',
|
76
|
-
'newyork_ny.xml')
|
77
|
-
)
|
78
|
-
)
|
79
66
|
FakeWeb.register_uri(:get,
|
80
|
-
"#{geo_url}gl=
|
81
|
-
:
|
67
|
+
"#{geo_url}gl=&q=New%20York%2C%20NY&output=json&key=#{KEY}&sensor=false",
|
68
|
+
:body => File.read(File.join(File.dirname(__FILE__),
|
82
69
|
'fixtures/geocode',
|
83
|
-
'
|
70
|
+
'newyork_ny.json')
|
84
71
|
)
|
85
72
|
)
|
86
|
-
|
87
73
|
FakeWeb.register_uri(:get,
|
88
|
-
"#{geo_url}gl
|
89
|
-
:
|
74
|
+
"#{geo_url}gl=CA&key=#{KEY}&output=json&q=T5B%204M9&sensor=false",
|
75
|
+
:body => File.read(File.join(File.dirname(__FILE__),
|
90
76
|
'fixtures/geocode',
|
91
|
-
'T5B4M9.
|
92
|
-
)
|
93
|
-
)
|
94
|
-
FakeWeb.register_uri(:get,
|
95
|
-
"#{geo_url}output=xml&q=T5B%204M9&gl=CA&key=#{KEY}",
|
96
|
-
:string => File.read(File.join(File.dirname(__FILE__),
|
97
|
-
'fixtures/geocode',
|
98
|
-
'T5B4M9.xml')
|
77
|
+
'T5B4M9.json')
|
99
78
|
)
|
100
79
|
)
|
101
80
|
FakeWeb.register_uri(:get,
|
102
|
-
"#{geo_url}gl=US&q=KSFO&output=
|
103
|
-
:
|
81
|
+
"#{geo_url}gl=US&q=KSFO&output=json&key=#{KEY}&sensor=false",
|
82
|
+
:body => File.read(File.join(File.dirname(__FILE__),
|
104
83
|
'fixtures/geocode',
|
105
|
-
'ksfo.
|
84
|
+
'ksfo.json')
|
106
85
|
)
|
107
86
|
)
|
108
87
|
FakeWeb.register_uri(:get,
|
109
|
-
"#{geo_url}gl=&q=Atlanta%2C%20GA%2C%20US&output=
|
110
|
-
:
|
88
|
+
"#{geo_url}gl=&q=Atlanta%2C%20GA%2C%20US&output=json&key=#{KEY}&sensor=false",
|
89
|
+
:body => File.read(File.join(File.dirname(__FILE__),
|
111
90
|
'fixtures/geocode',
|
112
|
-
'atlanta.
|
91
|
+
'atlanta.json')
|
113
92
|
)
|
114
93
|
)
|
115
94
|
FakeWeb.register_uri(:get,
|
116
95
|
"#{geo_url}output=xml&q=Atlanta%2C%20GA%2C%20US&gl=US&key=#{KEY}",
|
117
|
-
:
|
96
|
+
:body => File.read(File.join(File.dirname(__FILE__),
|
118
97
|
'fixtures/geocode',
|
119
98
|
'atlanta.xml')
|
120
99
|
)
|
@@ -124,35 +103,35 @@ end
|
|
124
103
|
#
|
125
104
|
FakeWeb.register_uri(:get,
|
126
105
|
"http://xoap.weather.com:80/search/search?where=Beverly%20Hills%2C%20CA%2C%20USA",
|
127
|
-
:
|
106
|
+
:body => File.read(File.join(File.dirname(__FILE__),
|
128
107
|
'fixtures/formats/weather_id',
|
129
108
|
'90210.xml')
|
130
109
|
)
|
131
110
|
)
|
132
111
|
FakeWeb.register_uri(:get,
|
133
112
|
"http://xoap.weather.com:80/search/search?where=New%20York%2C%20NY",
|
134
|
-
:
|
113
|
+
:body => File.read(File.join(File.dirname(__FILE__),
|
135
114
|
'fixtures/formats/weather_id',
|
136
115
|
'new_york.xml')
|
137
116
|
)
|
138
117
|
)
|
139
118
|
FakeWeb.register_uri(:get,
|
140
119
|
"http://xoap.weather.com:80/search/search?where=New%20York%2C%20NY%2C%20USA",
|
141
|
-
:
|
120
|
+
:body => File.read(File.join(File.dirname(__FILE__),
|
142
121
|
'fixtures/formats/weather_id',
|
143
122
|
'new_york.xml')
|
144
123
|
)
|
145
124
|
)
|
146
125
|
FakeWeb.register_uri(:get,
|
147
126
|
"http://xoap.weather.com:80/search/search?where=90210",
|
148
|
-
:
|
127
|
+
:body => File.read(File.join(File.dirname(__FILE__),
|
149
128
|
'fixtures/formats/weather_id',
|
150
129
|
'90210.xml')
|
151
130
|
)
|
152
131
|
)
|
153
132
|
FakeWeb.register_uri(:get,
|
154
|
-
"http://xoap.weather.com:80/search/search?where=
|
155
|
-
:
|
133
|
+
"http://xoap.weather.com:80/search/search?where=Millbrae%2C%20CA%2C%20USA",
|
134
|
+
:body => File.read(File.join(File.dirname(__FILE__),
|
156
135
|
'fixtures/formats/weather_id',
|
157
136
|
'ksfo.xml')
|
158
137
|
)
|
@@ -162,7 +141,7 @@ end
|
|
162
141
|
#
|
163
142
|
FakeWeb.register_uri(:get,
|
164
143
|
"http://weather.yahooapis.com:80/forecastrss?p=USGA0028",
|
165
|
-
:
|
144
|
+
:body => File.read(File.join(File.dirname(__FILE__),
|
166
145
|
'fixtures/formats/weather_id',
|
167
146
|
'from_USGA0028.xml')
|
168
147
|
)
|
@@ -173,14 +152,14 @@ end
|
|
173
152
|
#
|
174
153
|
FakeWeb.register_uri(:get,
|
175
154
|
"http://api.wunderground.com/auto/wui/geo/WXCurrentObXML/index.xml?query=51.055149%2C-114.062438",
|
176
|
-
:
|
155
|
+
:body => File.read(File.join(File.dirname(__FILE__),
|
177
156
|
'fixtures/services/wunderground',
|
178
157
|
'current_calgary_ab.xml')
|
179
158
|
)
|
180
159
|
)
|
181
160
|
FakeWeb.register_uri(:get,
|
182
161
|
"http://api.wunderground.com/auto/wui/geo/ForecastXML/index.xml?query=51.055149%2C-114.062438",
|
183
|
-
:
|
162
|
+
:body => File.read(File.join(File.dirname(__FILE__),
|
184
163
|
'fixtures/services/wunderground',
|
185
164
|
'forecast_calgary_ab.xml')
|
186
165
|
)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'spec_helper'
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
2
|
include Barometer
|
3
3
|
|
4
4
|
describe "Google" do
|
@@ -105,7 +105,7 @@ describe "Google" do
|
|
105
105
|
|
106
106
|
FakeWeb.register_uri(:get,
|
107
107
|
"http://google.com/ig/api?weather=#{CGI.escape(@query.q)}&hl=en-GB",
|
108
|
-
:
|
108
|
+
:body => File.read(File.join(File.dirname(__FILE__),
|
109
109
|
'../fixtures/services/google',
|
110
110
|
'calgary_ab.xml')
|
111
111
|
)
|
@@ -152,14 +152,14 @@ describe "Google" do
|
|
152
152
|
#
|
153
153
|
# FakeWeb.register_uri(:get,
|
154
154
|
# "http://api.wunderground.com/auto/wui/geo/WXCurrentObXML/index.xml?query=#{CGI.escape(@query.preferred)}",
|
155
|
-
# :
|
155
|
+
# :body => File.read(File.join(File.dirname(__FILE__),
|
156
156
|
# 'fixtures',
|
157
157
|
# 'current_calgary_ab.xml')
|
158
158
|
# )
|
159
159
|
# )
|
160
160
|
# FakeWeb.register_uri(:get,
|
161
161
|
# "http://api.wunderground.com/auto/wui/geo/ForecastXML/index.xml?query=#{CGI.escape(@query.preferred)}",
|
162
|
-
# :
|
162
|
+
# :body => File.read(File.join(File.dirname(__FILE__),
|
163
163
|
# 'fixtures',
|
164
164
|
# 'forecast_calgary_ab.xml')
|
165
165
|
# )
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'spec_helper'
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
2
|
|
3
3
|
describe "WeatherServices" do
|
4
4
|
|
@@ -134,7 +134,7 @@ describe "WeatherServices" do
|
|
134
134
|
|
135
135
|
it "returns current and future" do
|
136
136
|
measurement = @service.measure(@query)
|
137
|
-
measurement.current.is_a?(Measurement::Result).should be_true
|
137
|
+
measurement.current.is_a?(Barometer::Measurement::Result).should be_true
|
138
138
|
measurement.forecast.is_a?(Array).should be_true
|
139
139
|
end
|
140
140
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'spec_helper'
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
2
|
include Barometer
|
3
3
|
|
4
4
|
describe "WeatherBug" do
|
@@ -142,7 +142,7 @@ describe "WeatherBug" do
|
|
142
142
|
url = "http://#{WEATHERBUG_CODE}.api.wxbug.net:80/getLiveWeatherRSS.aspx?"
|
143
143
|
FakeWeb.register_uri(:get,
|
144
144
|
"#{url}ACode=#{WEATHERBUG_CODE}&OutputType=1&UnitType=1&zipCode=90210",
|
145
|
-
:
|
145
|
+
:body => File.read(File.join(File.dirname(__FILE__),
|
146
146
|
'../fixtures/services/weather_bug',
|
147
147
|
'90210_current.xml')
|
148
148
|
)
|
@@ -151,7 +151,7 @@ describe "WeatherBug" do
|
|
151
151
|
url2 = "http://#{WEATHERBUG_CODE}.api.wxbug.net:80/getForecastRSS.aspx?"
|
152
152
|
FakeWeb.register_uri(:get,
|
153
153
|
"#{url2}ACode=#{WEATHERBUG_CODE}&OutputType=1&UnitType=1&zipCode=90210",
|
154
|
-
:
|
154
|
+
:body => File.read(File.join(File.dirname(__FILE__),
|
155
155
|
'../fixtures/services/weather_bug',
|
156
156
|
'90210_forecast.xml')
|
157
157
|
)
|
@@ -198,7 +198,7 @@ describe "WeatherBug" do
|
|
198
198
|
url = "http://#{WEATHERBUG_CODE}.api.wxbug.net:80/getLiveWeatherRSS.aspx?"
|
199
199
|
FakeWeb.register_uri(:get,
|
200
200
|
"#{url}ACode=#{WEATHERBUG_CODE}&OutputType=1&UnitType=1&zipCode=90210",
|
201
|
-
:
|
201
|
+
:body => File.read(File.join(File.dirname(__FILE__),
|
202
202
|
'../fixtures/services/weather_bug',
|
203
203
|
'90210_current.xml')
|
204
204
|
)
|
@@ -207,7 +207,7 @@ describe "WeatherBug" do
|
|
207
207
|
url2 = "http://#{WEATHERBUG_CODE}.api.wxbug.net:80/getForecastRSS.aspx?"
|
208
208
|
FakeWeb.register_uri(:get,
|
209
209
|
"#{url2}ACode=#{WEATHERBUG_CODE}&OutputType=1&UnitType=1&zipCode=90210",
|
210
|
-
:
|
210
|
+
:body => File.read(File.join(File.dirname(__FILE__),
|
211
211
|
'../fixtures/services/weather_bug',
|
212
212
|
'90210_forecast.xml')
|
213
213
|
)
|
@@ -250,7 +250,7 @@ describe "WeatherBug" do
|
|
250
250
|
# builds forecasts
|
251
251
|
@measurement.forecast.size.should == 7
|
252
252
|
|
253
|
-
@measurement.forecast[0].date.should == Date.parse("May 15")
|
253
|
+
@measurement.forecast[0].date.should == Date.parse("May 15 2009")
|
254
254
|
@measurement.forecast[0].condition.should == "Partly Cloudy"
|
255
255
|
@measurement.forecast[0].icon.should == "3"
|
256
256
|
@measurement.forecast[0].high.to_i.should == 27
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'spec_helper'
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
2
|
include Barometer
|
3
3
|
|
4
4
|
describe "WeatherDotCom" do
|
@@ -123,7 +123,7 @@ describe "WeatherDotCom" do
|
|
123
123
|
|
124
124
|
FakeWeb.register_uri(:get,
|
125
125
|
"#{url}90210?dayf=5&unit=m&link=xoap&par=#{WEATHER_PARTNER_KEY}&prod=xoap&key=#{WEATHER_LICENSE_KEY}&cc=*",
|
126
|
-
:
|
126
|
+
:body => File.read(File.join(File.dirname(__FILE__),
|
127
127
|
'../fixtures/services/weather_dot_com',
|
128
128
|
'90210.xml')
|
129
129
|
)
|
@@ -171,7 +171,7 @@ describe "WeatherDotCom" do
|
|
171
171
|
|
172
172
|
FakeWeb.register_uri(:get,
|
173
173
|
"#{url}90210?dayf=5&unit=m&link=xoap&par=#{WEATHER_PARTNER_KEY}&prod=xoap&key=#{WEATHER_LICENSE_KEY}&cc=*",
|
174
|
-
:
|
174
|
+
:body => File.read(File.join(File.dirname(__FILE__),
|
175
175
|
'../fixtures/services/weather_dot_com',
|
176
176
|
'90210.xml')
|
177
177
|
)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'spec_helper'
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
2
|
include Barometer
|
3
3
|
|
4
4
|
describe "Wunderground" do
|
@@ -145,14 +145,14 @@ describe "Wunderground" do
|
|
145
145
|
|
146
146
|
FakeWeb.register_uri(:get,
|
147
147
|
"http://api.wunderground.com/auto/wui/geo/WXCurrentObXML/index.xml?query=#{CGI.escape(@query.q)}",
|
148
|
-
:
|
148
|
+
:body => File.read(File.join(File.dirname(__FILE__),
|
149
149
|
'../fixtures/services/wunderground',
|
150
150
|
'current_calgary_ab.xml')
|
151
151
|
)
|
152
152
|
)
|
153
153
|
FakeWeb.register_uri(:get,
|
154
154
|
"http://api.wunderground.com/auto/wui/geo/ForecastXML/index.xml?query=#{CGI.escape(@query.q)}",
|
155
|
-
:
|
155
|
+
:body => File.read(File.join(File.dirname(__FILE__),
|
156
156
|
'../fixtures/services/wunderground',
|
157
157
|
'forecast_calgary_ab.xml')
|
158
158
|
)
|
@@ -198,14 +198,14 @@ describe "Wunderground" do
|
|
198
198
|
|
199
199
|
FakeWeb.register_uri(:get,
|
200
200
|
"http://api.wunderground.com/auto/wui/geo/WXCurrentObXML/index.xml?query=#{CGI.escape(@query.q)}",
|
201
|
-
:
|
201
|
+
:body => File.read(File.join(File.dirname(__FILE__),
|
202
202
|
'../fixtures/services/wunderground',
|
203
203
|
'current_calgary_ab.xml')
|
204
204
|
)
|
205
205
|
)
|
206
206
|
FakeWeb.register_uri(:get,
|
207
207
|
"http://api.wunderground.com/auto/wui/geo/ForecastXML/index.xml?query=#{CGI.escape(@query.q)}",
|
208
|
-
:
|
208
|
+
:body => File.read(File.join(File.dirname(__FILE__),
|
209
209
|
'../fixtures/services/wunderground',
|
210
210
|
'forecast_calgary_ab.xml')
|
211
211
|
)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'spec_helper'
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
2
|
include Barometer
|
3
3
|
|
4
4
|
describe "Yahoo" do
|
@@ -92,7 +92,7 @@ describe "Yahoo" do
|
|
92
92
|
|
93
93
|
FakeWeb.register_uri(:get,
|
94
94
|
"http://weather.yahooapis.com:80/forecastrss?u=c&p=#{CGI.escape(@query.q)}",
|
95
|
-
:
|
95
|
+
:body => File.read(File.join(File.dirname(__FILE__),
|
96
96
|
'../fixtures/services/yahoo',
|
97
97
|
'90210.xml')
|
98
98
|
)
|
@@ -138,7 +138,7 @@ describe "Yahoo" do
|
|
138
138
|
|
139
139
|
FakeWeb.register_uri(:get,
|
140
140
|
"http://weather.yahooapis.com:80/forecastrss?u=c&p=#{CGI.escape(@query.q)}",
|
141
|
-
:
|
141
|
+
:body => File.read(File.join(File.dirname(__FILE__),
|
142
142
|
'../fixtures/services/yahoo',
|
143
143
|
'90210.xml')
|
144
144
|
)
|
data/spec/weather_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'spec_helper'
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
2
|
|
3
3
|
describe "Weather" do
|
4
4
|
|
@@ -83,10 +83,10 @@ describe "Weather" do
|
|
83
83
|
before(:each) do
|
84
84
|
@weather = Barometer::Weather.new
|
85
85
|
@wunderground = Barometer::Measurement.new(:wunderground)
|
86
|
-
@wunderground.current = Measurement::Result.new
|
86
|
+
@wunderground.current = Barometer::Measurement::Result.new
|
87
87
|
@wunderground.success = true
|
88
88
|
@yahoo = Barometer::Measurement.new(:yahoo)
|
89
|
-
@yahoo.current = Measurement::Result.new
|
89
|
+
@yahoo.current = Barometer::Measurement::Result.new
|
90
90
|
@yahoo.success = true
|
91
91
|
@google = Barometer::Measurement.new(:google)
|
92
92
|
@weather.measurements << @wunderground
|
@@ -298,7 +298,7 @@ describe "Weather" do
|
|
298
298
|
wunderground = Barometer::Measurement.new(:wunderground)
|
299
299
|
wunderground.success = true
|
300
300
|
@weather.measurements << wunderground
|
301
|
-
|
301
|
+
@weather.measurements.each { |m| m.stub!(:windy?).and_return(true) }
|
302
302
|
@weather.windy?.should be_true
|
303
303
|
end
|
304
304
|
|
@@ -306,7 +306,7 @@ describe "Weather" do
|
|
306
306
|
wunderground = Barometer::Measurement.new(:wunderground)
|
307
307
|
wunderground.success = true
|
308
308
|
@weather.measurements << wunderground
|
309
|
-
|
309
|
+
@weather.measurements.each { |m| m.stub!(:windy?).and_return(false) }
|
310
310
|
@weather.windy?.should be_false
|
311
311
|
end
|
312
312
|
|
@@ -334,7 +334,7 @@ describe "Weather" do
|
|
334
334
|
wunderground = Barometer::Measurement.new(:wunderground)
|
335
335
|
wunderground.success = true
|
336
336
|
@weather.measurements << wunderground
|
337
|
-
|
337
|
+
@weather.measurements.each { |m| m.stub!(:wet?).and_return(true) }
|
338
338
|
@weather.wet?.should be_true
|
339
339
|
end
|
340
340
|
|
@@ -342,7 +342,7 @@ describe "Weather" do
|
|
342
342
|
wunderground = Barometer::Measurement.new(:wunderground)
|
343
343
|
wunderground.success = true
|
344
344
|
@weather.measurements << wunderground
|
345
|
-
|
345
|
+
@weather.measurements.each { |m| m.stub!(:wet?).and_return(false) }
|
346
346
|
@weather.wet?.should be_false
|
347
347
|
end
|
348
348
|
|
@@ -370,7 +370,7 @@ describe "Weather" do
|
|
370
370
|
wunderground = Barometer::Measurement.new(:wunderground)
|
371
371
|
wunderground.success = true
|
372
372
|
@weather.measurements << wunderground
|
373
|
-
|
373
|
+
@weather.measurements.each { |m| m.stub!(:day?).and_return(true) }
|
374
374
|
@weather.day?.should be_true
|
375
375
|
@weather.night?.should be_false
|
376
376
|
end
|
@@ -379,7 +379,7 @@ describe "Weather" do
|
|
379
379
|
wunderground = Barometer::Measurement.new(:wunderground)
|
380
380
|
wunderground.success = true
|
381
381
|
@weather.measurements << wunderground
|
382
|
-
|
382
|
+
@weather.measurements.each { |m| m.stub!(:day?).and_return(false) }
|
383
383
|
@weather.day?.should be_false
|
384
384
|
@weather.night?.should be_true
|
385
385
|
end
|
@@ -402,8 +402,8 @@ describe "Weather" do
|
|
402
402
|
wunderground = Barometer::Measurement.new(:wunderground)
|
403
403
|
wunderground.success = true
|
404
404
|
@weather.measurements << wunderground
|
405
|
-
|
406
|
-
|
405
|
+
@weather.measurements.each { |m| m.stub!(:day?).and_return(true) }
|
406
|
+
@weather.measurements.each { |m| m.stub!(:sunny?).and_return(true) }
|
407
407
|
@weather.sunny?.should be_true
|
408
408
|
end
|
409
409
|
|
@@ -411,8 +411,8 @@ describe "Weather" do
|
|
411
411
|
wunderground = Barometer::Measurement.new(:wunderground)
|
412
412
|
wunderground.success = true
|
413
413
|
@weather.measurements << wunderground
|
414
|
-
|
415
|
-
|
414
|
+
@weather.measurements.each { |m| m.stub!(:day?).and_return(true) }
|
415
|
+
@weather.measurements.each { |m| m.stub!(:sunny?).and_return(false) }
|
416
416
|
@weather.sunny?.should be_false
|
417
417
|
end
|
418
418
|
|
@@ -420,8 +420,8 @@ describe "Weather" do
|
|
420
420
|
wunderground = Barometer::Measurement.new(:wunderground)
|
421
421
|
wunderground.success = true
|
422
422
|
@weather.measurements << wunderground
|
423
|
-
|
424
|
-
|
423
|
+
@weather.measurements.each { |m| m.stub!(:sunny?).and_return(true) }
|
424
|
+
@weather.measurements.each { |m| m.stub!(:day?).and_return(false) }
|
425
425
|
@weather.sunny?.should be_false
|
426
426
|
end
|
427
427
|
|