diff --git a/test/source/_with.dots/all.dots/2.4.0.md b/test/source/_with.dots/all.dots/2.4.0.md new file mode 100644 index 00000000..74d96bb1 --- /dev/null +++ b/test/source/_with.dots/all.dots/2.4.0.md @@ -0,0 +1,5 @@ +--- +title: v2.4.0 +--- + +v2.4.0 \ No newline at end of file diff --git a/test/source/_with.dots/file.with.dots.md b/test/source/_with.dots/file.with.dots.md new file mode 100644 index 00000000..e69de29b diff --git a/test/test_collections.rb b/test/test_collections.rb index 6cdb3184..97b891ef 100644 --- a/test/test_collections.rb +++ b/test/test_collections.rb @@ -17,15 +17,15 @@ class TestCollections < Test::Unit::TestCase end should "sanitize the label name" do - assert_equal @collection.label, "etcpassword" + assert_equal @collection.label, "....etcpassword" end should "have a sanitized relative path name" do - assert_equal @collection.relative_directory, "_etcpassword" + assert_equal @collection.relative_directory, "_....etcpassword" end should "have a sanitized full path" do - assert_equal @collection.directory, source_dir("_etcpassword") + assert_equal @collection.directory, source_dir("_....etcpassword") end end @@ -194,4 +194,31 @@ class TestCollections < Test::Unit::TestCase end end + context "with dots in the filenames" do + setup do + @site = fixture_site({ + "collections" => ["with.dots"], + "safe" => true + }) + @site.process + @collection = @site.collections["with.dots"] + end + + should "exist" do + assert_not_nil @collection + end + + should "contain one document" do + assert_equal 2, @collection.docs.size + end + + should "allow dots in the filename" do + assert_equal "_with.dots", @collection.relative_directory + end + + should "read document in subfolders with dots" do + assert @collection.docs.any? { |d| d.path.include?("all.dots") } + end + end + end