Last active
August 29, 2015 13:57
-
-
Save knewter/9478396 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Amnesia | |
defdatabase Database do | |
deftable User, [{ :id, autoincrement }, :name, :initials] | |
end | |
Amnesia.Schema.create | |
Amnesia.start | |
Database.create(disk: [node]) | |
Database.wait | |
defmodule AmnesiaTestTest do | |
use ExUnit.Case | |
use Database | |
test "inserting and fetching records" do | |
Amnesia.transaction do | |
john = User[name: "giggity"].write | |
end | |
Amnesia.transaction do | |
assert User.read(1).name == "giggity" | |
assert User.where(name == "giggity", select: id).values == [1] | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment