macro_rules! assert_response_snapshot {
($response:expr, $path:expr) => { ... };
($response:expr, $path:expr, mask: [$($field:expr),* $(,)?]) => { ... };
}Expand description
Macro for snapshot testing a response against a file fixture.
On first run (or when SNAPSHOT_UPDATE=1), saves the snapshot.
On subsequent runs, compares against the saved snapshot.
§Usage
ⓘ
let response = client.get("/api/users").send();
assert_response_snapshot!(response, "tests/snapshots/get_users.json");
// With field masking:
assert_response_snapshot!(response, "tests/snapshots/get_users.json", mask: ["id", "created_at"]);