|
@@
-11,16
+11,16
class FilesystemAdapterTest < ActiveSupport::TestCase
|
|
11
|
end
|
|
11
|
end
|
|
12
|
|
|
12
|
|
|
13
|
def test_entries
|
|
13
|
def test_entries
|
|
14
|
assert_equal 2, @adapter.entries.size
|
|
14
|
assert_equal 3, @adapter.entries.size
|
|
15
|
assert_equal ["dir", "test"], @adapter.entries.collect(&:name)
|
|
15
|
assert_equal ["dir", "japanese", "test"], @adapter.entries.collect(&:name)
|
|
16
|
assert_equal ["dir", "test"], @adapter.entries(nil).collect(&:name)
|
|
16
|
assert_equal ["dir", "japanese", "test"], @adapter.entries(nil).collect(&:name)
|
|
17
|
assert_equal ["dir", "test"], @adapter.entries("/").collect(&:name)
|
|
17
|
assert_equal ["dir", "japanese", "test"], @adapter.entries("/").collect(&:name)
|
|
18
|
["dir", "/dir", "/dir/", "dir/"].each do |path|
|
|
18
|
["dir", "/dir", "/dir/", "dir/"].each do |path|
|
|
19
|
assert_equal ["subdir", "dirfile"], @adapter.entries(path).collect(&:name)
|
|
19
|
assert_equal ["subdir", "dirfile"], @adapter.entries(path).collect(&:name)
|
|
20
|
end
|
|
20
|
end
|
|
21
|
# If y try to use "..", the path is ignored
|
|
21
|
# If y try to use "..", the path is ignored
|
|
22
|
["/../","dir/../", "..", "../", "/..", "dir/.."].each do |path|
|
|
22
|
["/../","dir/../", "..", "../", "/..", "dir/.."].each do |path|
|
|
23
|
assert_equal ["dir", "test"], @adapter.entries(path).collect(&:name),
|
|
23
|
assert_equal ["dir", "japanese", "test"], @adapter.entries(path).collect(&:name),
|
|
24
|
".. must be ignored in path argument"
|
|
24
|
".. must be ignored in path argument"
|
|
25
|
end
|
|
25
|
end
|
|
26
|
end
|
|
26
|
end
|