Add test for #1718

This commit is contained in:
Thomas Reynolds 2016-01-10 16:56:18 -08:00
parent b4a6a503b3
commit 5cac6a1896
4 changed files with 6 additions and 2 deletions

View file

@ -9,6 +9,7 @@ Feature: Directory Index
| a_folder/needs_index/index.html | | a_folder/needs_index/index.html |
| leave_me_alone.html | | leave_me_alone.html |
| wildcard_leave_me_alone.html | | wildcard_leave_me_alone.html |
| regex_leave_me_alone2.html |
| evil spaces/index.html | | evil spaces/index.html |
| regular/index.html | | regular/index.html |
| .htaccess | | .htaccess |
@ -21,12 +22,13 @@ Feature: Directory Index
| a_folder/needs_index.html | | a_folder/needs_index.html |
| leave_me_alone/index.html | | leave_me_alone/index.html |
| wildcard_leave_me_alone/index.html | | wildcard_leave_me_alone/index.html |
| regex_leave_me_alone2/index.html |
And the file "needs_index/index.html" should contain "Indexable" And the file "needs_index/index.html" should contain "Indexable"
And the file "a_folder/needs_index/index.html" should contain "Indexable" And the file "a_folder/needs_index/index.html" should contain "Indexable"
And the file "leave_me_alone.html" should contain "Stay away" And the file "leave_me_alone.html" should contain "Stay away"
And the file "regular/index.html" should contain "Regular" And the file "regular/index.html" should contain "Regular"
And the file "evil spaces/index.html" should contain "Filled with Evil Spaces" And the file "evil spaces/index.html" should contain "Filled with Evil Spaces"
Scenario: Preview normal file Scenario: Preview normal file
Given the Server is running at "indexable-app" Given the Server is running at "indexable-app"
When I go to "/needs_index/" When I go to "/needs_index/"

View file

@ -2,3 +2,4 @@ activate :directory_indexes
page "/leave_me_alone.html", directory_index: false page "/leave_me_alone.html", directory_index: false
page "/wildcard*", directory_index: false page "/wildcard*", directory_index: false
page /regex_.*/, directory_index: false

View file

@ -0,0 +1 @@
Stay away, wildcards!

View file

@ -44,7 +44,7 @@ module Middleman
# @option opts [Hash] locals Local variables for the template. These will be available when the template renders. # @option opts [Hash] locals Local variables for the template. These will be available when the template renders.
# @option opts [Hash] data Extra metadata to add to the page. This is the same as frontmatter, though frontmatter will take precedence over metadata defined here. Available via {Resource#data}. # @option opts [Hash] data Extra metadata to add to the page. This is the same as frontmatter, though frontmatter will take precedence over metadata defined here. Available via {Resource#data}.
# @return [void] # @return [void]
Contract String, Hash => Any Contract Or[String, Regexp], Hash => Any
def page(path, opts={}) def page(path, opts={})
options = opts.dup options = opts.dup