From 1be1d03eac31b943bc0ebe4348343c41cec8ccb9 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 9 Oct 2012 00:40:06 -0700 Subject: [PATCH] Update fs spec for new traverseTree callbacks --- spec/stdlib/fs-spec.coffee | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/spec/stdlib/fs-spec.coffee b/spec/stdlib/fs-spec.coffee index 49287b3ae..0317cdedd 100644 --- a/spec/stdlib/fs-spec.coffee +++ b/spec/stdlib/fs-spec.coffee @@ -62,7 +62,7 @@ describe "fs", -> fs.makeTree("/tmp/a/b/c") expect(fs.exists("/tmp/a/b/c")).toBeTruthy() - describe ".traverseTree(path, fn)", -> + describe ".traverseTree(path, onFile, onDirectory)", -> fixturesDir = null beforeEach -> @@ -70,19 +70,21 @@ describe "fs", -> it "calls fn for every path in the tree at the given path", -> paths = [] - fs.traverseTree fixturesDir, (path) -> + onPath = (path) -> paths.push(fs.join(fixturesDir, path)) true + fs.traverseTree fixturesDir, onPath, onPath expect(paths).toEqual fs.listTree(fixturesDir) it "does not recurse into a directory if it is pruned", -> paths = [] - fs.traverseTree fixturesDir, (path, prune) -> + onPath = (path) -> if path.match(/\/dir$/) false else paths.push(path) true + fs.traverseTree fixturesDir, onPath, onPath expect(paths.length).toBeGreaterThan 0 for path in paths