From b75aa4b8d6ef104a60c5ac84c3b90cedda30155c Mon Sep 17 00:00:00 2001 From: Jacques Distler Date: Sun, 27 Dec 2009 00:41:04 -0600 Subject: [PATCH] Fix a broken test --- app/models/wiki.rb | 2 +- test/functional/admin_controller_test.rb | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/models/wiki.rb b/app/models/wiki.rb index 42cb9114..7c39fda1 100644 --- a/app/models/wiki.rb +++ b/app/models/wiki.rb @@ -41,7 +41,7 @@ class Wiki def move_files(old_path, new_path) return if new_path == old_path default_path = Rails.root.join("webs", "files") - FileUtils.rmdir(new_path) + FileUtils.rmdir(new_path) if File.exist?(new_path) if [old_path, new_path].include? default_path File.rename(old_path, new_path) FileUtils.rmdir(old_path.parent) unless old_path == default_path diff --git a/test/functional/admin_controller_test.rb b/test/functional/admin_controller_test.rb index 8059a3aa..2de3dda7 100644 --- a/test/functional/admin_controller_test.rb +++ b/test/functional/admin_controller_test.rb @@ -140,6 +140,7 @@ class AdminControllerTest < ActionController::TestCase assert @web.allow_uploads? assert_equal 300, @web.max_upload_size assert File.directory? Rails.root.join("webs", "renamed_wiki1", "files") + assert !File.exist?(Rails.root.join("webs", "renamed_wiki1", "wiki1")) assert !File.exist?(Rails.root.join("webs", "wiki1")) end @@ -157,6 +158,7 @@ class AdminControllerTest < ActionController::TestCase assert_response :success assert @response.has_template_object?('error') assert File.directory? Rails.root.join("webs", "wiki1", "files") + assert !File.exist?(Rails.root.join("webs", "renamed_wiki1", "wiki1")) assert !File.exist?(Rails.root.join("webs", "renamed_wiki1")) end @@ -179,6 +181,7 @@ class AdminControllerTest < ActionController::TestCase assert !@web.count_pages? assert !@web.allow_uploads? assert File.directory? Rails.root.join("webs", "renamed_wiki1", "files") + assert !File.exist?(Rails.root.join("webs", "renamed_wiki1", "wiki1")) assert !File.exist?(Rails.root.join("webs", "wiki1")) end