Upload.Adapters.Test (upload v0.3.0)
An Upload.Adapter
that keeps track of uploaded files in memory, so that
you can make assertions.
Example
test "files are uploaded" do
assert {:ok, _} = start_supervised(Upload.Adapters.Test)
assert {:ok, upload} = Upload.cast_path("/path/to/file.txt")
assert {:ok, upload} = Upload.transfer(upload)
assert map_size(Upload.Adapters.Test.get_uploads()) == 1
end
Link to this section Summary
Functions
Returns a specification to start this module under a supervisor.
Get all uploads.
Add an upload to the state.
Starts and agent for the test adapter.
Stops the agent for the test adapter.
Link to this section Functions
Link to this function
child_spec(arg)
Returns a specification to start this module under a supervisor.
See Supervisor
.
Link to this function
get_uploads()
Get all uploads.
Link to this function
put_upload(upload)
Add an upload to the state.
Link to this function
start_link(_)
Starts and agent for the test adapter.
Link to this function
stop(reason \\ :normal, timeout \\ :infinity)
Stops the agent for the test adapter.