Assertions over Phoenix routers, controllers, and LiveViews, built on
Presubmit.Adapters.PhoenixRouter and Presubmit.Adapters.PhoenixHandler.
Summary
Functions
Asserts every controller or LiveView the commit adds is routed by some router in the resulting tree.
Routes added by the commit, across every router it touched.
Routes removed by the commit.
Functions
@spec assert_routed(Presubmit.Commit.t()) :: :ok
Asserts every controller or LiveView the commit adds is routed by some router in the resulting tree.
Routers are discovered across the tree, and plug modules are resolved
through scope aliasing exactly as Phoenix does, so this holds whether
the route was added in this commit or an earlier one, and fails even when
the router file was edited for an unrelated reason.
Not every controller is routed by design: action_fallback targets are
exempt, and so is any module a router names at all — custom route macros
and forwarded plugs mention their modules without the adapter knowing
what the macro does.
@spec routes_added(Presubmit.Commit.t()) :: [ Presubmit.Adapters.PhoenixRouter.Route.t() ]
Routes added by the commit, across every router it touched.
@spec routes_removed(Presubmit.Commit.t()) :: [ Presubmit.Adapters.PhoenixRouter.Route.t() ]
Routes removed by the commit.