Skip to content

Commit

Permalink
Release the Shuttles tab (#300)
Browse files Browse the repository at this point in the history
  • Loading branch information
digitalcora authored Dec 5, 2019
1 parent 2cf1438 commit 9769475
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 12 deletions.
3 changes: 1 addition & 2 deletions apps/site/config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ config :site, SiteWeb.ViewHelpers, google_tag_manager_id: System.get_env("GOOGLE

config :laboratory,
features: [
{:schedule_direction_redesign, "Schedule direction_redesign", ""},
{:shuttles, "Shuttles page", ""}
{:schedule_direction_redesign, "Schedule direction_redesign", ""}
],
cookie: [
# one month,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ defmodule SiteWeb.ScheduleController.ShuttlesController do

use SiteWeb, :controller

alias SiteWeb.ControllerHelpers
alias SiteWeb.ScheduleView

import SiteWeb.ScheduleController.Line.Helpers,
Expand All @@ -20,7 +19,6 @@ defmodule SiteWeb.ScheduleController.ShuttlesController do
def show(conn, _) do
conn
|> put_view(ScheduleView)
|> ControllerHelpers.noindex()
|> assign(:paragraphs, get_shuttle_paragraphs(conn))
|> assign(:shuttle_data, get_shuttle_data(conn))
|> render("show.html", [])
Expand Down
2 changes: 1 addition & 1 deletion apps/site/lib/site_web/views/schedule_view.ex
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ defmodule SiteWeb.ScheduleView do
]

tabs =
if Laboratory.enabled?(conn, :shuttles) and ShuttleDiversion.active?([route.id], now) do
if ShuttleDiversion.active?([route.id], now) do
[
%HeaderTab{
id: "shuttles",
Expand Down
8 changes: 1 addition & 7 deletions apps/site/test/site_web/views/schedule_view_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -1026,10 +1026,6 @@ defmodule SiteWeb.ScheduleViewTest do
end

describe "route_header_tabs/1" do
def set_shuttles_laboratory_flag(conn) do
put_req_header(conn, "cookie", "shuttles=true")
end

test "returns 4 tabs for commuter rail (1 hidden by css)", %{conn: conn} do
tabs =
conn
Expand Down Expand Up @@ -1061,11 +1057,10 @@ defmodule SiteWeb.ScheduleViewTest do
refute tabs =~ "timetable-tab"
end

test "includes shuttles tab, if flag set and any shuttle alerts", %{conn: conn} do
test "includes shuttles tab if there are any shuttle alerts", %{conn: conn} do
with_mock Site.ShuttleDiversion, active?: fn _, _ -> true end do
tabs =
conn
|> set_shuttles_laboratory_flag
|> assign(:route, %Route{id: "83", type: 3})
|> assign(:tab, "alerts")
|> assign(:tab_params, [])
Expand All @@ -1080,7 +1075,6 @@ defmodule SiteWeb.ScheduleViewTest do
with_mock Site.ShuttleDiversion, active?: fn _, _ -> false end do
tabs =
conn
|> set_shuttles_laboratory_flag
|> assign(:route, %Route{id: "83", type: 3})
|> assign(:tab, "alerts")
|> assign(:tab_params, [])
Expand Down

0 comments on commit 9769475

Please sign in to comment.