pushex v0.2.3 Pushex.Sandbox View Source

Sandbox where notifications get saved when the application is running in sandbox mode.

This is meant to be used in tests, and should not be used in production. Note that all operations are dependent on the pid, so the process calling and Pushex.push/2 and the process calling Pushex.Sandbox.list_notifications/1 must be the same, or the pid should be passed explicitly otherwise.

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor.

Clear all the recorded notifications.

List recorded notifications keeping their order of arrival.

Records the notification. This is used by Pushex.ResponseHandler.Sandbox to record requests and responses.

Wait until a notification arrives.

Link to this section Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

clear_notifications(opts \\ [])

View Source
clear_notifications([{:pid, pid()}]) :: :ok

Clear all the recorded notifications.

Link to this function

list_notifications(opts \\ [])

View Source
list_notifications([{:pid, pid()}]) :: [
  {Pushex.GCM.response(), Pushex.GCM.request(), {pid(), reference()}}
]

List recorded notifications keeping their order of arrival.

Link to this function

record_notification(response, request, info)

View Source
record_notification(
  Pushex.GCM.response(),
  Pushex.GCM.request(),
  {pid(), reference()}
) :: :ok

Records the notification. This is used by Pushex.ResponseHandler.Sandbox to record requests and responses.

Link to this function

wait_notifications(opts \\ [])

View Source
wait_notifications(
  pid: pid(),
  timeout: non_neg_integer(),
  count: non_neg_integer()
) :: [{Pushex.GCM.response(), Pushex.GCM.request(), {pid(), reference()}}]

Wait until a notification arrives.