From cebb15c9ca575a51b7bacd315ca49a71817b91d0 Mon Sep 17 00:00:00 2001 From: Ben Hollis Date: Fri, 6 Jan 2012 22:40:28 -0800 Subject: [PATCH] Add a new (failing) feature test to show the behavior I think would be good for the "ignore" helper. These scenarios show ignoring files by their source paths rather than their output paths, ignoring globbed paths (including into subdirectories), and ignoring paths that will be transformed by directory_indexes. These scenarios pertain to issues #229 and #225. --- middleman-core/features/ignore.feature | 50 +++++++++++++++++++ middleman-core/fixtures/ignore-app/config.rb | 2 - .../fixtures/ignore-app/source/about.html.erb | 0 .../source/articles/template.html.erb | 1 - .../source/images/icon/messages.png | 0 .../fixtures/ignore-app/source/images/pic.png | 0 .../ignore-app/source/images/portrait.jpg | 0 .../fixtures/ignore-app/source/index.html.erb | 0 .../fixtures/ignore-app/source/plain.html | 0 .../ignore-app/source/reports/another.html | 0 .../ignore-app/source/reports/index.html | 0 .../ignore-app/source/template.html.erb | 1 - 12 files changed, 50 insertions(+), 4 deletions(-) create mode 100644 middleman-core/features/ignore.feature delete mode 100644 middleman-core/fixtures/ignore-app/config.rb create mode 100644 middleman-core/fixtures/ignore-app/source/about.html.erb delete mode 100644 middleman-core/fixtures/ignore-app/source/articles/template.html.erb create mode 100644 middleman-core/fixtures/ignore-app/source/images/icon/messages.png create mode 100644 middleman-core/fixtures/ignore-app/source/images/pic.png create mode 100644 middleman-core/fixtures/ignore-app/source/images/portrait.jpg create mode 100644 middleman-core/fixtures/ignore-app/source/index.html.erb create mode 100644 middleman-core/fixtures/ignore-app/source/plain.html create mode 100644 middleman-core/fixtures/ignore-app/source/reports/another.html create mode 100644 middleman-core/fixtures/ignore-app/source/reports/index.html delete mode 100644 middleman-core/fixtures/ignore-app/source/template.html.erb diff --git a/middleman-core/features/ignore.feature b/middleman-core/features/ignore.feature new file mode 100644 index 00000000..ecdd0cff --- /dev/null +++ b/middleman-core/features/ignore.feature @@ -0,0 +1,50 @@ +Feature: Ignoring paths + Scenario: Ignore a single path + Given a fixture app "ignore-app" + And a file named "config.rb" with: + """ + ignore 'about.html.erb' + ignore 'plain.html' + """ + And a successfully built app at "ignore-app" + Then the following files should exist: + | build/index.html | + And the following files should not exist: + | build/plain.html | + | build/about.html | + + Scenario: Ignore a globbed path + Given a fixture app "ignore-app" + And a file named "config.rb" with: + """ + ignore '*.erb' + ignore 'reports/*' + ignore 'images/**/*.png' + """ + And a successfully built app at "ignore-app" + Then the following files should exist: + | build/plain.html | + | build/images/portrait.jpg | + And the following files should not exist: + | build/about.html | + | build/index.html | + | build/reports/index.html | + | build/reports/another.html | + | build/images/pic.png | + | build/images/icons/messages.png | + + Scenario: Ignore with directory indexes + Given a fixture app "ignore-app" + And a file named "config.rb" with: + """ + activate :directory_indexes + ignore 'about.html.erb' + ignore 'plain.html' + """ + And a successfully built app at "ignore-app" + Then the following files should exist: + | build/index.html | + And the following files should not exist: + | build/about/index.html | + | build/plain/index.html | + diff --git a/middleman-core/fixtures/ignore-app/config.rb b/middleman-core/fixtures/ignore-app/config.rb deleted file mode 100644 index a45ae89a..00000000 --- a/middleman-core/fixtures/ignore-app/config.rb +++ /dev/null @@ -1,2 +0,0 @@ -page "/my_article.html", :proxy => "/template.html", :ignore => true, :layout => false -page "/articles/my_article.html", :proxy => "/articles/template.html", :ignore => true, :layout => false \ No newline at end of file diff --git a/middleman-core/fixtures/ignore-app/source/about.html.erb b/middleman-core/fixtures/ignore-app/source/about.html.erb new file mode 100644 index 00000000..e69de29b diff --git a/middleman-core/fixtures/ignore-app/source/articles/template.html.erb b/middleman-core/fixtures/ignore-app/source/articles/template.html.erb deleted file mode 100644 index 829671bc..00000000 --- a/middleman-core/fixtures/ignore-app/source/articles/template.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%= [1,2,3].join("-") %> \ No newline at end of file diff --git a/middleman-core/fixtures/ignore-app/source/images/icon/messages.png b/middleman-core/fixtures/ignore-app/source/images/icon/messages.png new file mode 100644 index 00000000..e69de29b diff --git a/middleman-core/fixtures/ignore-app/source/images/pic.png b/middleman-core/fixtures/ignore-app/source/images/pic.png new file mode 100644 index 00000000..e69de29b diff --git a/middleman-core/fixtures/ignore-app/source/images/portrait.jpg b/middleman-core/fixtures/ignore-app/source/images/portrait.jpg new file mode 100644 index 00000000..e69de29b diff --git a/middleman-core/fixtures/ignore-app/source/index.html.erb b/middleman-core/fixtures/ignore-app/source/index.html.erb new file mode 100644 index 00000000..e69de29b diff --git a/middleman-core/fixtures/ignore-app/source/plain.html b/middleman-core/fixtures/ignore-app/source/plain.html new file mode 100644 index 00000000..e69de29b diff --git a/middleman-core/fixtures/ignore-app/source/reports/another.html b/middleman-core/fixtures/ignore-app/source/reports/another.html new file mode 100644 index 00000000..e69de29b diff --git a/middleman-core/fixtures/ignore-app/source/reports/index.html b/middleman-core/fixtures/ignore-app/source/reports/index.html new file mode 100644 index 00000000..e69de29b diff --git a/middleman-core/fixtures/ignore-app/source/template.html.erb b/middleman-core/fixtures/ignore-app/source/template.html.erb deleted file mode 100644 index 829671bc..00000000 --- a/middleman-core/fixtures/ignore-app/source/template.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%= [1,2,3].join("-") %> \ No newline at end of file