extracted wiki fixture to test_helper (it still doesn't deserge a class of its own, but one day it might)

This commit is contained in:
Alexey Verkhovsky 2005-01-21 19:40:04 +00:00
parent a9cf729f25
commit e619e575ce
2 changed files with 24 additions and 25 deletions

View file

@ -654,29 +654,4 @@ class WikiControllerTest < Test::Unit::TestCase
assert_equal [another_wiki, @web], r.template_objects['webs'] assert_equal [another_wiki, @web], r.template_objects['webs']
end end
# Wiki fixture
def setup_test_wiki
@wiki = ApplicationController.wiki = WikiServiceWithNoPersistence.new
@web = @wiki.create_web('Test Wiki 1', 'wiki1')
@home = @wiki.write_page('wiki1', 'HomePage', 'First revision of the HomePage end', Time.now,
Author.new('AnAuthor', '127.0.0.1'))
end
def setup_wiki_with_three_pages
@oak = @wiki.write_page('wiki1', 'Oak',
"All about oak.\n" +
"category: trees",
5.minutes.ago, Author.new('TreeHugger', '127.0.0.2'))
@elephant = @wiki.write_page('wiki1', 'Elephant',
"All about elephants.\n" +
"category: animals",
10.minutes.ago, Author.new('Guest', '127.0.0.2'))
end
def tear_down_wiki
ApplicationController.wiki = nil
end
end end

View file

@ -23,6 +23,30 @@ class Test::Unit::TestCase
return @request, @response return @request, @response
end end
# Wiki fixture for tests
def setup_test_wiki
@wiki = ApplicationController.wiki = WikiServiceWithNoPersistence.new
@web = @wiki.create_web('Test Wiki 1', 'wiki1')
@home = @wiki.write_page('wiki1', 'HomePage', 'First revision of the HomePage end', Time.now,
Author.new('AnAuthor', '127.0.0.1'))
end
def setup_wiki_with_three_pages
@oak = @wiki.write_page('wiki1', 'Oak',
"All about oak.\n" +
"category: trees",
5.minutes.ago, Author.new('TreeHugger', '127.0.0.2'))
@elephant = @wiki.write_page('wiki1', 'Elephant',
"All about elephants.\n" +
"category: animals",
10.minutes.ago, Author.new('Guest', '127.0.0.2'))
end
def tear_down_wiki
ApplicationController.wiki = nil
end
end end
class WikiServiceWithNoPersistence class WikiServiceWithNoPersistence