Skip to content

Instantly share code, notes, and snippets.

@knewter
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save knewter/9478396 to your computer and use it in GitHub Desktop.
Save knewter/9478396 to your computer and use it in GitHub Desktop.
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