Extracted storage of files functionality from controller to an object called FileYard.

There is one file yard per web.
This commit is contained in:
Alexey Verkhovsky 2005-01-23 01:36:51 +00:00
parent 0d81292168
commit 1d82582c3b
7 changed files with 112 additions and 54 deletions

View file

@ -8,11 +8,12 @@ class WikiServiceTest < Test::Unit::TestCase
# Clean the test storage directory before the run
unless defined? @@storage_cleaned
FileUtils.rm(Dir[RAILS_ROOT + 'storage/test/*.command_log'])
FileUtils.rm(Dir[RAILS_ROOT + 'storage/test/*.snapshot'])
FileUtils.rm(Dir[RAILS_ROOT + 'storage/test/*.tex'])
FileUtils.rm(Dir[RAILS_ROOT + 'storage/test/*.zip'])
FileUtils.rm(Dir[RAILS_ROOT + 'storage/test/*.pdf'])
FileUtils.rm(Dir[RAILS_ROOT + '/storage/test/*.command_log'])
FileUtils.rm(Dir[RAILS_ROOT + '/storage/test/*.snapshot'])
FileUtils.rm(Dir[RAILS_ROOT + '/storage/test/*.tex'])
FileUtils.rm(Dir[RAILS_ROOT + '/storage/test/*.zip'])
FileUtils.rm(Dir[RAILS_ROOT + '/storage/test/*.pdf'])
FileUtils.rm(Dir[RAILS_ROOT + '/storage/test/instiki/*'])
@@cleaned_storage = true
WikiService.instance.setup('pswd', 'Wiki', 'wiki')
end
@ -20,6 +21,7 @@ class WikiServiceTest < Test::Unit::TestCase
def setup
@s = WikiService.instance
@s.create_web 'Instiki', 'instiki'
@web = @s.webs['instiki']
end
def teardown
@ -61,6 +63,12 @@ class WikiServiceTest < Test::Unit::TestCase
}
end
def test_file_yard
file_yard = @s.file_yard(@web)
assert_equal FileYard, file_yard.class
assert_equal(@s.storage_path + '/instiki', file_yard.files_path)
end
# Checks that a method call or a block doesn;t change the persisted state of the wiki
# Usage: