Skip to content

Commit

Permalink
Set pollen value in API fixures for forecasts
Browse files Browse the repository at this point in the history
  • Loading branch information
edavey committed Oct 7, 2024
1 parent 5b11919 commit 41a8645
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
18 changes: 15 additions & 3 deletions spec/feature_steps/forecast_steps.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
module ForecastSteps
def given_a_forecast_for_today
forecasts << Fixtures::API.build_forecast(day: :today, air_pollution_status: :high)
forecasts << Fixtures::API.build_forecast(
day: :today,
air_pollution_status: :high,
pollen: 4
)
end

def and_a_forecast_for_tomorrow
forecasts << Fixtures::API.build_forecast(day: :tomorrow, air_pollution_status: :moderate)
forecasts << Fixtures::API.build_forecast(
day: :tomorrow,
air_pollution_status: :moderate,
pollen: 5
)
end

def and_a_forecast_for_the_day_after_tomorrow
forecasts << Fixtures::API.build_forecast(day: :day_after_tomorrow, air_pollution_status: :very_high)
forecasts << Fixtures::API.build_forecast(
day: :day_after_tomorrow,
air_pollution_status: :very_high,
pollen: 6
)
end

def forecasts
Expand Down
4 changes: 2 additions & 2 deletions spec/fixtures/api/forecasts.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module Fixtures
module API
class << self
def build_forecast(day:, air_pollution_status:)
def build_forecast(day:, air_pollution_status:, pollen: 4)
<<~JSON
{
"NO2": 1,
Expand All @@ -10,7 +10,7 @@ def build_forecast(day:, air_pollution_status:)
"PM2.5": 1,
"forecast_date": "#{forecast_date_for(day)}",
"non_pollution_version": null,
"pollen": -999,
"pollen": #{pollen},
"pollution_version": 202410011407,
"rain_am": 1.31,
"rain_pm": 3.01,
Expand Down

0 comments on commit 41a8645

Please sign in to comment.