Skip to content

Commit

Permalink
edit tests to reflect change in arguments being used
Browse files Browse the repository at this point in the history
  • Loading branch information
kbhoffmann committed Mar 14, 2022
1 parent 45d9890 commit bc67221
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions spec/facades/weather_facade_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,34 +17,31 @@
stub_request(:get, "https://api.openweathermap.org/data/2.5/onecall?appid=b223e219a2cff0890dbe4fae9e6d5836&exclude=minutely,alerts&lat=39.738453&lon=-104.984853&units=imperial").
to_return(status: 200, body: json_response, headers: {})

latitude = 39.738453
longitude = -104.984853
weather_data = JSON.parse(json_response, symbolize_names: true)

expect(WeatherFacade.current_weather(latitude, longitude)).to be_a(CurrentWeather)
expect(WeatherFacade.current_weather(weather_data)).to be_a(CurrentWeather)
end

it 'sends information to the Daily Weather poro' do
json_response = File.read('spec/fixtures/request_weather_data.json')
stub_request(:get, "https://api.openweathermap.org/data/2.5/onecall?appid=b223e219a2cff0890dbe4fae9e6d5836&exclude=minutely,alerts&lat=39.742043&lon=-104.991531&units=imperial").
to_return(status: 200, body: json_response, headers: {})

latitude = 39.742043
longitude = -104.991531
weather_data = JSON.parse(json_response, symbolize_names: true)

expect(WeatherFacade.daily_weather(latitude, longitude).first).to be_a(DailyWeather)
expect(WeatherFacade.daily_weather(latitude, longitude).length).to eq(5)
expect(WeatherFacade.daily_weather(weather_data).first).to be_a(DailyWeather)
expect(WeatherFacade.daily_weather(weather_data).length).to eq(5)
end

it 'sends information to the Hourly Weather poro' do
json_response = File.read('spec/fixtures/request_weather_data.json')
stub_request(:get, "https://api.openweathermap.org/data/2.5/onecall?appid=b223e219a2cff0890dbe4fae9e6d5836&exclude=minutely,alerts&lat=39.742043&lon=-104.991531&units=imperial").
to_return(status: 200, body: json_response, headers: {})

latitude = 39.742043
longitude = -104.991531
weather_data = JSON.parse(json_response, symbolize_names: true)

expect(WeatherFacade.hourly_weather(latitude, longitude).first).to be_an(HourlyWeather)
expect(WeatherFacade.hourly_weather(latitude, longitude).length).to eq(8)
expect(WeatherFacade.hourly_weather(weather_data).first).to be_an(HourlyWeather)
expect(WeatherFacade.hourly_weather(weather_data).length).to eq(8)
end

it 'sends information to the Hourly Weather poro for trip eta' do
Expand Down

0 comments on commit bc67221

Please sign in to comment.