Geminix.Testing (geminix v0.2.0)

Summary

Functions

Returns true if the user has explicitly setting the cassette mode to :replay. Will return false if the cassete is replaying but the mode is :record.

Run the given function with a cassette using ReqCassette.

Run the given function with a shared cassette using ReqCassette. A shared cassete is required if one is making requests from different processes.

Functions

replaying?()

Returns true if the user has explicitly setting the cassette mode to :replay. Will return false if the cassete is replaying but the mode is :record.

This is meant to be used when testing functions that poll APIs. When hitting the real API, you will often wait a long time (i.e. many seconds or minutes). But when testing your code, if you are just replaying a cassette there is no need to wait that long to run the tests.

with_cassette(cassette_name, opts \\ [], fun)

Run the given function with a cassette using ReqCassette.

This function encapsulates some utilities to make it easier to test the Geminix functions, such as automatically adding the right testing plug to the process dictionary and automatically redacting the API key headers.

This function disables the cache (the goal is to work on cached requests while actually calling the functions that process those requests)

with_shared_cassette(cassette_name, opts \\ [], fun)

Run the given function with a shared cassette using ReqCassette. A shared cassete is required if one is making requests from different processes.

This function encapsulates some utilities to make it easier to test the Geminix functions, such as automatically adding the right testing plug to the process dictionary and automatically redacting the API key headers.

This function disables the cache (the goal is to work on cached requests while actually calling the functions that process those requests)