diff --git a/spec/feature_steps/air_quality_steps.rb b/spec/feature_steps/air_quality_steps.rb index 2b4dc7a5..26ca4930 100644 --- a/spec/feature_steps/air_quality_steps.rb +++ b/spec/feature_steps/air_quality_steps.rb @@ -4,11 +4,11 @@ def given_an_air_pollution_prediction_for_today_w_high_warning_status end def and_an_air_pollution_prediction_for_tomorrow_w_moderate_warning_status - forecasts << Fixtures::API.build_forecast(day: :tomorrow, air_pollution_status: :moderate) + forecasts << Fixtures::API.build_forecast(day: :tomorrow, air_pollution_status: :moderate, daqi_value: 4) end def and_an_air_pollution_prediction_for_day_after_tomorrow_w_v_high_warning_status - 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, daqi_value: 10) end def given_an_air_pollution_prediction_for_today_w_low_status @@ -116,6 +116,9 @@ def then_i_see_an_air_quality_alert_of_moderate_for_tomorrow_v2 within(".alert-guidance") do expect_to_see_guidance_for(:moderate) end + + expect(page).to have_css(".tab.tomorrow.daqi-alert-after-today-selected-level-4") + expect(page).not_to have_css(".tab.day_after_tomorrow.daqi-alert-after-today-selected-level-10") end def then_i_see_an_air_quality_alert_of_v_high_for_day_after_tomorrow_v2 @@ -125,6 +128,9 @@ def then_i_see_an_air_quality_alert_of_v_high_for_day_after_tomorrow_v2 within(".alert-guidance") do expect_to_see_guidance_for(:very_high) end + + expect(page).to have_css(".tab.day_after_tomorrow.daqi-alert-after-today-selected-level-10") + expect(page).not_to have_css(".tab.tomorrow.daqi-alert-after-today-selected-level-4") end def and_i_see_an_air_quality_alert_of_moderate_for_tomorrow diff --git a/spec/fixtures/api/forecasts.rb b/spec/fixtures/api/forecasts.rb index b6ba4eb3..69fd2a57 100644 --- a/spec/fixtures/api/forecasts.rb +++ b/spec/fixtures/api/forecasts.rb @@ -1,7 +1,7 @@ module Fixtures module API class << self - def build_forecast(day:, air_pollution_status:, pollen: :moderate, temperature: :normal, uv: :moderate) + def build_forecast(day:, air_pollution_status:, pollen: :moderate, temperature: :normal, uv: :moderate, daqi_value: nil) <<~JSON { "NO2": 1, @@ -16,7 +16,7 @@ def build_forecast(day:, air_pollution_status:, pollen: :moderate, temperature: "rain_pm": 3.01, "temp_max": #{max_temp_for(temperature)}, "temp_min": #{min_temp_for(temperature)}, - "total": #{daqi_value_for_level(air_pollution_status)}, + "total": #{daqi_value || daqi_value_for_level(air_pollution_status)}, "total_status": "#{total_status_for(air_pollution_status)}", "uv": #{daqi_value_for_level(uv)}, "wind_am": 5.3,