GitSnapshot (git_snapshot v0.1.8)

View Source

GitSnapshot is a library for snapshot testing using git.

This library takes string snaphots (see GitSnapshot.Snapshot) and stores them on disk. When a file exists the current test value will be compared to the staged content of that file.

If the compared values are equal everything is fine.

If the compared values are not equal the file is overwritten with the new value and an ExUnit.AssertionError is raised for the test to fail. The changed value can become accepted by staging the updated file contents.

Summary

Functions

assert_image(context, key, image, opts \\ [])

Assert on a image.

Example

test "name", context do

assert_image(context, "file_name.png", image)

end

assert_json(context, key, value, opts \\ [])

Assert on json data.

Options

See Jason.decode/2.

Example

test "name", context do

assert_json(context, "file_name", "value")

end

assert_snapshot(context, key, value)

Assert on a snapshot.

Example

test "name", context do

assert_snapshot(context, "file_name", "value")

end

assert_snapshots(items, callback)

Assert over multiple snapshots.