diff --git a/test/dotcom_web/controllers/alert_controller_test.exs b/test/dotcom_web/controllers/alert_controller_test.exs index 7b7e3300c1..11f980bcd1 100644 --- a/test/dotcom_web/controllers/alert_controller_test.exs +++ b/test/dotcom_web/controllers/alert_controller_test.exs @@ -13,6 +13,9 @@ defmodule DotcomWeb.AlertControllerTest do setup :verify_on_exit! setup do + cache = Application.get_env(:dotcom, :cache) + cache.flush() + stub(Routes.Repo.Mock, :by_type, fn route_type -> build_list(2, :route, %{type: route_type}) end) diff --git a/test/dotcom_web/controllers/schedule/predictions_test.exs b/test/dotcom_web/controllers/schedule/predictions_test.exs index 294fa63766..af75dc8f21 100644 --- a/test/dotcom_web/controllers/schedule/predictions_test.exs +++ b/test/dotcom_web/controllers/schedule/predictions_test.exs @@ -6,6 +6,9 @@ defmodule DotcomWeb.ScheduleController.PredictionsTest do import Test.Support.Factories.Predictions.Prediction setup %{conn: conn} do + cache = Application.get_env(:dotcom, :cache) + cache.flush() + conn = conn |> assign(:date, ~D[2017-01-01]) @@ -243,8 +246,12 @@ defmodule DotcomWeb.ScheduleController.PredictionsTest do trip_id_match = Enum.join(Enum.sort([trip_id_1, trip_id_2]), ",") Predictions.Repo.Mock - |> expect(:all, fn [route: ^route_id] -> [] end) - |> expect(:all, fn [trip: ^trip_id_match] -> + |> expect(:all, fn arg -> + assert arg[:route] == route_id + [] + end) + |> expect(:all, fn arg -> + assert arg[:trip] == trip_id_match # we transform the data into this form so that we only need to make one repo call [prediction_1, prediction_2] end) @@ -286,12 +293,12 @@ defmodule DotcomWeb.ScheduleController.PredictionsTest do prediction = build(:prediction, %{stop: %Stops.Stop{id: stop_id_1}}) Predictions.Repo.Mock - |> expect(:all, fn [route: id] -> - assert id == route_id + |> expect(:all, fn arg -> + assert arg[:route] == route_id [] end) - |> expect(:all, fn [trip: trip_id] -> - assert trip_id == Enum.join(Enum.sort([trip_id_1, trip_id_2]), ",") + |> expect(:all, fn arg -> + assert arg[:trip] == Enum.join(Enum.sort([trip_id_1, trip_id_2]), ",") # we transform the data into this form so that we only need to make one repo call [ prediction diff --git a/test/dotcom_web/live/trip_planner_test.exs b/test/dotcom_web/live/trip_planner_test.exs index fb88778dfd..84d3347728 100644 --- a/test/dotcom_web/live/trip_planner_test.exs +++ b/test/dotcom_web/live/trip_planner_test.exs @@ -24,8 +24,8 @@ defmodule DotcomWeb.Live.TripPlannerTest do %{html: html, view: view} end - test "toggles the date input when changing from 'now'", %{html: html, view: view} do - end + # test "toggles the date input when changing from 'now'", %{html: html, view: view} do + # end test "summarizes the selected modes", %{view: view, html: html} do assert html =~ "All modes" @@ -61,10 +61,10 @@ defmodule DotcomWeb.Live.TripPlannerTest do assert html =~ "Subway and Bus" end - test "shows errors on form submit", %{view: view} do - end + # test "shows errors on form submit", %{view: view} do + # end - test "pushes updated location to the map", %{view: view} do - end + # test "pushes updated location to the map", %{view: view} do + # end end end diff --git a/test/predictions/repo_test.exs b/test/predictions/repo_test.exs index 64a41f61f3..688aac3d5c 100644 --- a/test/predictions/repo_test.exs +++ b/test/predictions/repo_test.exs @@ -87,7 +87,9 @@ defmodule Predictions.RepoTest do "arrival_time" => before_time }, relationships: %{ - "route" => [route_item] + "route" => [route_item], + "trip" => [], + "vehicle" => [] } }) ++ build_list(2, :prediction_item, %{ @@ -95,7 +97,9 @@ defmodule Predictions.RepoTest do "arrival_time" => after_time }, relationships: %{ - "route" => [route_item] + "route" => [route_item], + "trip" => [], + "vehicle" => [] } }) }