Moved the last unit test where it belongs
This commit is contained in:
parent
6ff74f6b5a
commit
bec3c98227
|
@ -339,30 +339,6 @@ class PageRendererTest < Test::Unit::TestCase
|
||||||
assert_equal WikiReference::LINKED_PAGE, references[1].link_type
|
assert_equal WikiReference::LINKED_PAGE, references[1].link_type
|
||||||
end
|
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
|
private
|
||||||
|
|
||||||
def add_sample_pages
|
def add_sample_pages
|
||||||
|
|
|
@ -7,6 +7,7 @@ class PageTest < Test::Unit::TestCase
|
||||||
@page = pages(:first_page)
|
@page = pages(:first_page)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def test_lock
|
def test_lock
|
||||||
assert !@page.locked?(Time.local(2004, 4, 4, 16, 50))
|
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
|
assert_equal revisions_number_before, @page.revisions.size
|
||||||
end
|
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
|
def test_rollback
|
||||||
@page.revise("spot two", Time.now, "David", test_renderer)
|
@page.revise("spot two", Time.now, "David", test_renderer)
|
||||||
@page.revise("spot three", Time.now + 2000, "David", test_renderer)
|
@page.revise("spot three", Time.now + 2000, "David", test_renderer)
|
||||||
|
|
Loading…
Reference in a new issue