spec/utopia/path_spec.rb in utopia-0.12.5 vs spec/utopia/path_spec.rb in utopia-0.12.6
- old
+ new
@@ -26,7 +26,21 @@
root = Utopia::Path["/"]
expect(root).to be_absolute
expect(root + Utopia::Path["foo/bar"]).to be == Utopia::Path["/foo/bar"]
end
+
+ it "should compute all descendant paths" do
+ root = Utopia::Path["/foo/bar"]
+
+ descendants = root.descend.to_a
+
+ expect(descendants[0].components).to be == [""]
+ expect(descendants[1].components).to be == ["", "foo"]
+ expect(descendants[2].components).to be == ["", "foo", "bar"]
+
+ ascendants = root.ascend.to_a
+
+ expect(descendants.reverse).to be == ascendants
+ end
end
end