From aee8e325249ecb965947c63fc3acfdae2f7253c9 Mon Sep 17 00:00:00 2001 From: Thomas Reynolds Date: Sat, 31 Dec 2011 12:56:17 -0800 Subject: [PATCH] test sitemap removal --- middleman-core/features/preview_changes.feature | 13 ++++++++++++- .../step_definitions/middleman_steps.rb | 12 ++++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/middleman-core/features/preview_changes.feature b/middleman-core/features/preview_changes.feature index f3a3bda1..054ef2ed 100644 --- a/middleman-core/features/preview_changes.feature +++ b/middleman-core/features/preview_changes.feature @@ -15,4 +15,15 @@ Feature: Preview Changes """ When I go to "/content.html" Then I should see "Hola Mundo" - \ No newline at end of file + + Scenario: A template is removed during preview + Given the Server is running at "preview-app" + And the file "source/a-page.html.erb" has the contents + """ + Hello World + """ + When I go to "/a-page.html" + Then I should see "Hello World" + And the file "source/a-page.html.erb" is removed + When I go to "/a-page.html" + Then I should see "File Not Found" diff --git a/middleman-core/lib/middleman-core/step_definitions/middleman_steps.rb b/middleman-core/lib/middleman-core/step_definitions/middleman_steps.rb index 8e284a95..39f7f702 100644 --- a/middleman-core/lib/middleman-core/step_definitions/middleman_steps.rb +++ b/middleman-core/lib/middleman-core/step_definitions/middleman_steps.rb @@ -5,11 +5,19 @@ Given /^a project at "([^\"]*)"$/ do |dirname| end Then /^the file "([^\"]*)" has the contents$/ do |path, contents| - file_path = File.expand_path(path, @target) - File.open(file_path, 'w') { |f| f.write(contents) } + write_file(path, contents) step %Q{the file "#{path}" did change} end +Then /^the file "([^\"]*)" is removed$/ do |path| + step %Q{I remove the file "#{path}"} + step %Q{the file "#{path}" did delete} +end + Then /^the file "([^\"]*)" did change$/ do |path| @server_inst.file_did_change(path) +end + +Then /^the file "([^\"]*)" did delete$/ do |path| + @server_inst.file_did_delete(path) end \ No newline at end of file