Skip to content

Instantly share code, notes, and snippets.

@taybin taybin/nodetest.ex
Last active Aug 29, 2015

What would you like to do?
ecto many to many test
defmodule NodeTest do
use ExUnit.Case
test "can have childen and parents" do
node1 = %Node{name: "parent"} |> Repo.insert
node2 = %Node{name: "child2"} |> Repo.insert
%NodeToNode{parent_id:, child_id:} |> Repo.insert
assert Node.get_children(node1) == [node2]
assert Node.get_parents(node2) == [node1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.