2753: Add tests for CollectionsHelper.file_path.
authorBrett Smith <brett@curoverse.com>
Mon, 12 May 2014 15:21:12 +0000 (11:21 -0400)
committerBrett Smith <brett@curoverse.com>
Tue, 13 May 2014 21:32:25 +0000 (17:32 -0400)
apps/workbench/test/unit/helpers/collections_helper_test.rb

index 16a85d9bcaabe56f6b2ead2568f434b6d00507ca..56d23c5c37fc7948b938ed8b737e59ff90f23db8 100644 (file)
@@ -1,4 +1,12 @@
 require 'test_helper'
 
 class CollectionsHelperTest < ActionView::TestCase
+  test "file_path generates short names" do
+    assert_equal('foo', CollectionsHelper.file_path(['.', 'foo', 0]),
+                 "wrong result for filename in collection root")
+    assert_equal('foo/bar', CollectionsHelper.file_path(['foo', 'bar', 0]),
+                 "wrong result for filename in directory without leading .")
+    assert_equal('foo/bar', CollectionsHelper.file_path(['./foo', 'bar', 0]),
+                 "wrong result for filename in directory with leading .")
+  end
 end