goldrust

Macro goldrust 

Source
macro_rules! goldrust {
    ($file_extension:expr) => { ... };
    ($file_extension:expr, $function_id:expr) => { ... };
}
Expand description

Create a new instance of Goldrust.

A new instance of Goldrust should be created for each test.

§Parameters

  • $file_extension: The file extension of the golden file. The function_id will be automatically used as the current function name which this macro is called from.
  • $function_id(optional): The identifier of the function.

§Environment Variables

The configurations are based on the environment variables:

  • GOLDRUST_DIR: The directory where the golden files will be saved. Defaults to tests/golden
  • GOLDRUST_ALLOW_EXTERNAL_API_CALL: Whether external api calls are allowed.
  • GOLDRUST_UPDATE_GOLDEN_FILES: Whether golden files should be updated.

Even if GOLDRUST_ALLOW_EXTERNAL_API_CALL is set to true, the default behavior is to use local golden files without making external API calls, which is the preferred behavior for testing.