From e619e575ce63e8bb71955d02545109528991412d Mon Sep 17 00:00:00 2001 From: Alexey Verkhovsky Date: Fri, 21 Jan 2005 19:40:04 +0000 Subject: [PATCH] extracted wiki fixture to test_helper (it still doesn't deserge a class of its own, but one day it might) --- test/functional/wiki_controller_test.rb | 25 ------------------------- test/test_helper.rb | 24 ++++++++++++++++++++++++ 2 files changed, 24 insertions(+), 25 deletions(-) diff --git a/test/functional/wiki_controller_test.rb b/test/functional/wiki_controller_test.rb index dd608c1b..03cc3796 100755 --- a/test/functional/wiki_controller_test.rb +++ b/test/functional/wiki_controller_test.rb @@ -654,29 +654,4 @@ class WikiControllerTest < Test::Unit::TestCase assert_equal [another_wiki, @web], r.template_objects['webs'] 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 diff --git a/test/test_helper.rb b/test/test_helper.rb index 1258ad01..d01d38bd 100755 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -23,6 +23,30 @@ class Test::Unit::TestCase return @request, @response 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 class WikiServiceWithNoPersistence