Moved the last unit test where it belongs

This commit is contained in:
Alexey Verkhovsky 2005-09-11 06:28:59 +00:00
parent 6ff74f6b5a
commit bec3c98227
2 changed files with 28 additions and 24 deletions

View file

@ -339,30 +339,6 @@ class PageRendererTest < Test::Unit::TestCase
assert_equal WikiReference::LINKED_PAGE, references[1].link_type
end
def test_rendering_changes_references_from_wanted_to_linked
new_page = @web.add_page('NewPage', 'Reference to WantedPage, and to WantedPage2',
Time.now, 'AlexeyVerkhovsky', test_renderer)
references = new_page.wiki_references(true)
assert_equal 2, references.size
assert_equal 'WantedPage', references[0].referenced_page_name
assert_equal WikiReference::WANTED_PAGE, references[0].link_type
assert_equal 'WantedPage2', references[1].referenced_page_name
assert_equal WikiReference::WANTED_PAGE, references[1].link_type
wanted_page = @web.add_page('WantedPage', 'And here it is!',
Time.now, 'AlexeyVerkhovsky', test_renderer)
# link type stored for NewPage -> WantedPage reference should change from WANTED to LINKED
# reference NewPage -> WantedPage2 should remain the same
references = new_page.wiki_references(true)
assert_equal 2, references.size
assert_equal 'WantedPage', references[0].referenced_page_name
assert_equal WikiReference::LINKED_PAGE, references[0].link_type
assert_equal 'WantedPage2', references[1].referenced_page_name
assert_equal WikiReference::WANTED_PAGE, references[1].link_type
end
private
def add_sample_pages

View file

@ -7,6 +7,7 @@ class PageTest < Test::Unit::TestCase
@page = pages(:first_page)
end
def test_lock
assert !@page.locked?(Time.local(2004, 4, 4, 16, 50))
@ -84,6 +85,33 @@ class PageTest < Test::Unit::TestCase
assert_equal revisions_number_before, @page.revisions.size
end
def test_revise_changes_references_from_wanted_to_linked_for_new_pages
web = Web.find(1)
new_page = Page.new(:web => web, :name => 'NewPage')
new_page.revise('Reference to WantedPage, and to WantedPage2', Time.now, 'AlexeyVerkhovsky',
test_renderer)
references = new_page.wiki_references(true)
assert_equal 2, references.size
assert_equal 'WantedPage', references[0].referenced_page_name
assert_equal WikiReference::WANTED_PAGE, references[0].link_type
assert_equal 'WantedPage2', references[1].referenced_page_name
assert_equal WikiReference::WANTED_PAGE, references[1].link_type
wanted_page = Page.new(:web => web, :name => 'WantedPage')
wanted_page.revise('And here it is!', Time.now, 'AlexeyVerkhovsky', test_renderer)
# link type stored for NewPage -> WantedPage reference should change from WANTED to LINKED
# reference NewPage -> WantedPage2 should remain the same
references = new_page.wiki_references(true)
assert_equal 2, references.size
assert_equal 'WantedPage', references[0].referenced_page_name
assert_equal WikiReference::LINKED_PAGE, references[0].link_type
assert_equal 'WantedPage2', references[1].referenced_page_name
assert_equal WikiReference::WANTED_PAGE, references[1].link_type
end
def test_rollback
@page.revise("spot two", Time.now, "David", test_renderer)
@page.revise("spot three", Time.now + 2000, "David", test_renderer)