bureaucrat v0.2.7 Bureaucrat.Helpers

Link to this section Summary

Functions

Adds a conn to the generated documentation.

Adds a conn to the generated documentation

Adds a Phoenix.Socket.Message to the generated documentation.

Helper function for adding the phoenix_controller and phoenix_action keys to the private map of the request that's coming from the test modules.

Link to this section Functions

Link to this macro

doc(conn)

(macro)

Adds a conn to the generated documentation.

The name of the test currently being executed will be used as a description for the example.

Link to this macro

doc(conn, desc)

(macro)

Adds a conn to the generated documentation

The description, and additional options can be passed in the second argument:

Examples

conn = conn()
  |> get("/api/v1/products")
  |> doc("List all products")

conn = conn()
  |> get("/api/v1/products")
  |> doc(description: "List all products", operation_id: "list_products")
Link to this macro

doc_broadcast_from(socket, event, message)

(macro)
Link to this macro

doc_broadcast_from!(socket, event, message)

(macro)
Link to this macro

doc_push(socket, event)

(macro)

Adds a Phoenix.Socket.Message to the generated documentation.

The name of the test currently being executed will be used as a description for the example.

Link to this macro

doc_push(socket, event, payload)

(macro)
Link to this function

format_test_name(arg)

Link to this function

group_title_for(mod, list)

Link to this function

plug_doc(conn, list)

Helper function for adding the phoenix_controller and phoenix_action keys to the private map of the request that's coming from the test modules.

For example:

test "all items - unauthenticated", %{conn: conn} do conn |> get(itempath(conn, :index)) |> plugdoc(module: __MODULE, action: :index) |> doc() |> assert_unauthenticated() end

The request from this test will never touch the controller that's being tested, because it is being piped through a plug that authenticates the user and redirects to another page. In this scenario, we use the plug_doc function.