From bec3c98227ad8be506ec02073049669b136cb188 Mon Sep 17 00:00:00 2001 From: Alexey Verkhovsky Date: Sun, 11 Sep 2005 06:28:59 +0000 Subject: [PATCH] Moved the last unit test where it belongs --- test/unit/page_renderer_test.rb | 24 ------------------------ test/unit/page_test.rb | 28 ++++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 24 deletions(-) diff --git a/test/unit/page_renderer_test.rb b/test/unit/page_renderer_test.rb index c8bbeb92..32c172db 100644 --- a/test/unit/page_renderer_test.rb +++ b/test/unit/page_renderer_test.rb @@ -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 diff --git a/test/unit/page_test.rb b/test/unit/page_test.rb index 8b63f67a..e466b926 100644 --- a/test/unit/page_test.rb +++ b/test/unit/page_test.rb @@ -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)