1463 |
1463 |
end
|
1464 |
1464 |
end
|
1465 |
1465 |
|
|
1466 |
def test_render_page_hierarchy
|
|
1467 |
parent_page = WikiPage.find(1)
|
|
1468 |
child_page = WikiPage.find_by(parent_id: parent_page.id)
|
|
1469 |
pages_by_parent_id = { nil =>[parent_page], parent_page.id => [child_page] }
|
|
1470 |
result = render_page_hierarchy(pages_by_parent_id, nil)
|
|
1471 |
assert_select_in result, 'ul.pages-hierarchy li a[href=?]', project_wiki_page_path(project_id: parent_page.project, id: parent_page.title, version: nil )
|
|
1472 |
assert_select_in result, 'ul.pages-hierarchy li ul.pages-hierarchy a[href=?]', project_wiki_page_path(project_id: child_page.project, id: child_page.title, version: nil )
|
|
1473 |
end
|
|
1474 |
|
|
1475 |
def test_render_page_hierarchy_with_options_timestamp_should_include_timestamp
|
|
1476 |
parent_page = WikiPage.find(1)
|
|
1477 |
child_page = WikiPage.find_by(parent_id: parent_page.id)
|
|
1478 |
pages_by_parent_id = { nil =>[parent_page], parent_page.id => [child_page] }
|
|
1479 |
result = render_page_hierarchy(pages_by_parent_id, nil, :timestamp => true)
|
|
1480 |
assert_select_in result, 'ul.pages-hierarchy li a[title=?]', l(:label_updated_time, distance_of_time_in_words(Time.now, parent_page.updated_on))
|
|
1481 |
assert_select_in result, 'ul.pages-hierarchy li ul.pages-hierarchy a[title=?]', l(:label_updated_time, distance_of_time_in_words(Time.now, child_page.updated_on))
|
|
1482 |
end
|
|
1483 |
|
|
1484 |
def test_render_page_hierarchy_when_action_is_export
|
|
1485 |
parent_page = WikiPage.find(1)
|
|
1486 |
child_page = WikiPage.find_by(parent_id: parent_page.id)
|
|
1487 |
pages_by_parent_id = { nil =>[parent_page], parent_page.id => [child_page] }
|
|
1488 |
|
|
1489 |
# Change controller and action using stub
|
|
1490 |
controller.stubs(:controller_name).returns('wiki')
|
|
1491 |
controller.stubs(:action_name).returns("export")
|
|
1492 |
|
|
1493 |
result = render_page_hierarchy(pages_by_parent_id, nil)
|
|
1494 |
assert_select_in result, 'ul.pages-hierarchy li a[href=?]', "##{parent_page.title}"
|
|
1495 |
assert_select_in result, 'ul.pages-hierarchy li ul.pages-hierarchy a[href=?]', "##{child_page.title}"
|
|
1496 |
end
|
|
1497 |
|
1466 |
1498 |
def test_avatar_with_user
|
1467 |
1499 |
with_settings :gravatar_enabled => '1' do
|
1468 |
1500 |
assert_include Digest::MD5.hexdigest('jsmith@somenet.foo'), avatar(User.find_by_mail('jsmith@somenet.foo'))
|