Struct goldenfile::mint::Mint
[−]
[src]
pub struct Mint { /* fields omitted */ }
A Mint creates goldenfiles.
When a Mint goes out of scope, it will do one of two things depending on the
value of the REGENERATE_GOLDENFILES
environment variable:
- If
REGENERATE_GOLDENFILES!=1
, it will check the new goldenfile contents against their old contents, and panic if they differ. - If
REGENERATE_GOLDENFILES=1
, it will replace the old goldenfile contents with the newly written contents.
Methods
impl Mint
[src]
fn new<P: AsRef<Path>>(path: P) -> Self
Create a new goldenfile Mint.
All goldenfiles will be created in the Mint's directory.
fn new_goldenfile<P: AsRef<Path>>(&mut self, path: P) -> Result<File>
Create a new goldenfile.
The returned file is actually a temporary file, not the goldenfile
itself. When the Mint goes out of scope, it will either check the temp
file against the real goldenfile, or replace the real goldenfile based
on the value of the REGENERATE_GOLDENFILES
environment variable.
fn check_goldenfiles(&self)
Check new goldenfile contents against old, and panic if they differ.
This is called automatically when a Mint goes out of scope and
REGENERATE_GOLDENFILES!=1
.
fn update_goldenfiles(&self)
Overwrite old goldenfile contents with their new contents.
This is called automatically when a Mint goes out of scope and
REGENERATE_GOLDENFILES=1
.