Fix a broken test

This commit is contained in:
Jacques Distler 2009-12-27 00:41:04 -06:00
parent 601331b508
commit b75aa4b8d6
2 changed files with 4 additions and 1 deletions

View file

@ -41,7 +41,7 @@ class Wiki
def move_files(old_path, new_path) def move_files(old_path, new_path)
return if new_path == old_path return if new_path == old_path
default_path = Rails.root.join("webs", "files") 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 if [old_path, new_path].include? default_path
File.rename(old_path, new_path) File.rename(old_path, new_path)
FileUtils.rmdir(old_path.parent) unless old_path == default_path FileUtils.rmdir(old_path.parent) unless old_path == default_path

View file

@ -140,6 +140,7 @@ class AdminControllerTest < ActionController::TestCase
assert @web.allow_uploads? assert @web.allow_uploads?
assert_equal 300, @web.max_upload_size assert_equal 300, @web.max_upload_size
assert File.directory? Rails.root.join("webs", "renamed_wiki1", "files") 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")) assert !File.exist?(Rails.root.join("webs", "wiki1"))
end end
@ -157,6 +158,7 @@ class AdminControllerTest < ActionController::TestCase
assert_response :success assert_response :success
assert @response.has_template_object?('error') assert @response.has_template_object?('error')
assert File.directory? Rails.root.join("webs", "wiki1", "files") 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")) assert !File.exist?(Rails.root.join("webs", "renamed_wiki1"))
end end
@ -179,6 +181,7 @@ class AdminControllerTest < ActionController::TestCase
assert !@web.count_pages? assert !@web.count_pages?
assert !@web.allow_uploads? assert !@web.allow_uploads?
assert File.directory? Rails.root.join("webs", "renamed_wiki1", "files") 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")) assert !File.exist?(Rails.root.join("webs", "wiki1"))
end end