Sha256: 2de135e79c2ec093ed8b638dd01209dd920d02c712ab8e15dd7f29010f9878a1
Contents?: true
Size: 1.15 KB
Versions: 2
Compression:
Stored size: 1.15 KB
Contents
require 'spec_helper' describe OpenWeatherAPI::API do describe 'When fetching hourly forecast weather' do let(:api) { OpenWeatherAPI::API.new( api_key: ENV['OPEN_WEATHER_API_KEY'], default_language: 'es', default_country_code: 'es' ) } it 'should retrieve data by city name' do expect(api.forecast(:hourly, city: 'Santa Cruz de Tenerife')[:cod].to_i).to eq(200) end it 'should retrieve data by city id' do expect(api.forecast(:hourly, id: 6360638)[:cod].to_i).to eq(200) end it 'should retrieve data by geolocation' do expect(api.forecast(:hourly, lon: -16.20302, lat: 28.53924)[:cod].to_i).to eq(200) end it 'works with a given block' do json1, json2 = nil json1 = api.forecast(:hourly, city: 'Santa Cruz de Tenerife') { |json| json2 = json } expect(json1).to eq(json2) end it 'works with xml format' do expect(api.forecast(:hourly, city: 'Santa Cruz de Tenerife', mode: :xml)).not_to be_nil end it 'works with html format' do expect(api.forecast(:hourly, city: 'Santa Cruz de Tenerife', mode: :html)).not_to be_nil end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
open-weather-api-0.0.6 | spec/forecast_hourly_spec.rb |
open-weather-api-0.0.5 | spec/forecast_hourly_spec.rb |