test/test.rb in weather_in_poland-0.0.4 vs test/test.rb in weather_in_poland-0.0.5

- old
+ new

@@ -6,25 +6,38 @@ class TestAPI < Test::Unit::TestCase def setup @weather = WeatherInPoland.new + @response = @weather.find_city end - - #check code and city, images, and getting data - def test_all + + def test_find_city location = 'Pomorskie, Gdynia' correct_city = 'Gdynia' correct_code = 493421 + + assert @response - response = @weather.find_city(location) - assert(response) assert_equal(correct_city, @weather.city) assert_equal(correct_code, @weather.code) - + end + + def test_get_weather @data = @weather.get_weather(@weather.code) assert_not_nil(@data) - + end + + def test_wind_direction + @data = @weather.get_weather(@weather.code) + direction = get_wind_direction(@data) + assert_not_nil direction + end + + def test_get_image + @data = @weather.get_weather(@weather.code) assert_not_nil(@data.condition.code) + assert_not_nil(@data.astronomy.sunrise) + assert_not_nil(@data.astronomy.sunset) end end