Commit 898ef58 1 parent 788ad9c commit 898ef58 Copy full SHA for 898ef58
File tree 2 files changed +8
-1
lines changed
2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ defmodule Hierarch.LTree do
74
74
"""
75
75
def concat ( one , another ) do
76
76
[ one , another ]
77
- |> Enum . reject ( fn ( label ) -> label == "" end )
77
+ |> Enum . reject ( fn ( label ) -> label == nil or label == "" end )
78
78
|> join ( )
79
79
end
80
80
end
Original file line number Diff line number Diff line change @@ -27,6 +27,13 @@ defmodule HierarchTest do
27
27
assert catelog . path == parent . id
28
28
end
29
29
30
+ test "builds a child of the root" do
31
+ parent = % Catelog { name: "Top" , path: nil } |> Repo . insert!
32
+ catelog = Catelog . build_child_of ( parent , % { name: "Top.Science" } )
33
+
34
+ assert catelog . path == parent . id
35
+ end
36
+
30
37
test "builds a root" do
31
38
catelog = Catelog . build_child_of ( nil , % { name: "Top.Science" } )
32
39
You can’t perform that action at this time.
0 commit comments