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:
parent
a9cf729f25
commit
e619e575ce
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue