Library, that dumps your test to files on first run.
On second run test's result are compared with dumps.
For example, if you have many tests, which are checking function result, API for example. You can use Floppy
test "Returns list of Items in the Cart" do
cart = Cart.find_by(email: "[email protected])
items = CartItems.find_by(cart: cart)
Floppy.assert(items)
end
Floppy.assert
on first run generates file with extension .floppy
, but on second run items
are compared with previous result.
If results are equal, test passed. Otherwise you have to change test or accept new result by command FLOPPY_MODE=rewrite mix test path_to_failed_test.exs
def deps do
[
{:floppy, "~> 0.3.0", only: [:test]}
]
end