pushex v0.2.0 Pushex.Sandbox

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.send_notification/2 and the process calling Pushex.Sandbox.list_notifications/1 must be the same, or the pid should be passed explicitly otherwise.

Summary

Functions

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

Functions

clear_notifications(opts \\ [])
clear_notifications([{:pid, pid}]) :: :ok

Clear all the recorded notifications.

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

List recorded notifications keeping their order of arrival.

record_notification(response, request, info)
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.

wait_notifications(opts \\ [])
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.