2005-01-16 23:40:44 +01:00
|
|
|
#!/bin/env ruby
|
|
|
|
|
|
|
|
require File.dirname(__FILE__) + '/../test_helper'
|
2005-01-15 21:26:54 +01:00
|
|
|
require 'wiki_service'
|
2005-01-17 00:17:30 +01:00
|
|
|
require 'fileutils'
|
2005-01-15 21:26:54 +01:00
|
|
|
|
|
|
|
class WikiServiceTest < Test::Unit::TestCase
|
2005-01-17 00:17:30 +01:00
|
|
|
|
|
|
|
# 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'])
|
|
|
|
@@cleaned_storage = true
|
|
|
|
end
|
|
|
|
|
2005-01-15 21:26:54 +01:00
|
|
|
def setup
|
2005-01-17 00:17:30 +01:00
|
|
|
@s = WikiService.instance
|
2005-01-15 21:26:54 +01:00
|
|
|
@s.create_web 'Instiki', 'instiki'
|
|
|
|
end
|
|
|
|
|
2005-01-17 00:17:30 +01:00
|
|
|
def teardown
|
|
|
|
@s.delete_web 'instiki'
|
|
|
|
end
|
|
|
|
|
2005-01-15 21:26:54 +01:00
|
|
|
def test_read_write_page
|
|
|
|
@s.write_page 'instiki', 'FirstPage', "Electric shocks, I love 'em",
|
|
|
|
Time.now, 'DavidHeinemeierHansson'
|
|
|
|
assert_equal "Electric shocks, I love 'em", @s.read_page('instiki', 'FirstPage').content
|
|
|
|
end
|
|
|
|
end
|