PhoenixMountable.Test (PhoenixMountable v0.2.1)

Copy Markdown View Source

Helpers for testing a mountable library.

use PhoenixMountable.Test, host: MyLib.TestHost

imports Plug.Conn, Phoenix.ConnTest and Phoenix.LiveViewTest (when available), sets @endpoint to the host's (see PhoenixMountable.TestHost), and adds a conn with an empty session to each test's context.

build_mount/3 builds a mount without a router, to test the library's options, PhoenixMountable.normalize_options/1 and PhoenixMountable.session/3.

Summary

Functions

The mount a host would get with my_lib path, opts, validated and normalized like the mount macro does, but without a router.

Functions

build_mount(definition, path \\ "/", opts \\ [])

@spec build_mount(module(), String.t(), keyword()) :: PhoenixMountable.Mount.t()

The mount a host would get with my_lib path, opts, validated and normalized like the mount macro does, but without a router.

mount = PhoenixMountable.Test.build_mount(MyLib.Router, "/my_lib", features: [:beta])
assert mount.options.features == [:beta]