expected v0.1.1 Expected.Store.Test View Source
A module for testing Expected.Store implementations.
In order to test a new Expected.Store, create a test module and use
Expected.Store.Test by specifying the store to test:
defmodule MyExpected.StoreTest do
use ExUnit.Case
use Expected.Store.Test, store: MyExpected.Store
# Must be defined for Expected.Store.Test to work.
defp init_store(_) do
# Insert @login1 defined in Expected.Store.Test in your store.
# ...
# Return a map containing your options as `opts`.
%{opts: init(table: :expected)}
end
# Test your init function
describe "init/1" do
test "returns the table name" do
assert init(table: :expected) == :expected
end
end
end
With this minimal code, the behaviours of the implementations for
Expected.Store.list_user_logins/2, Expected.Store.get/3,
Expected.Store.put/2, Expected.Store.delete/3 and
Expected.Store.clean_old_logins/2 are automatically tested.