Last active
August 29, 2015 14:07
-
-
Save taybin/3cf9c9f47a800d122632 to your computer and use it in GitHub Desktop.
ecto many to many test
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
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: node1.id, child_id: node.id} |> Repo.insert | |
assert Node.get_children(node1) == [node2] | |
assert Node.get_parents(node2) == [node1] | |
end | |
emd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment