1286 |
1286 |
end
|
1287 |
1287 |
end
|
1288 |
1288 |
|
|
1289 |
def test_render_page_hierarchy
|
|
1290 |
parent_page = WikiPage.find(1)
|
|
1291 |
child_page = WikiPage.find_by(parent_id: parent_page.id)
|
|
1292 |
pages_by_parent_id = { nil =>[parent_page], parent_page.id => [child_page] }
|
|
1293 |
result = render_page_hierarchy(pages_by_parent_id, nil)
|
|
1294 |
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 )
|
|
1295 |
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 )
|
|
1296 |
end
|
|
1297 |
|
|
1298 |
def test_render_page_hierarchy_with_options_timestamp_should_include_timestamp
|
|
1299 |
parent_page = WikiPage.find(1)
|
|
1300 |
child_page = WikiPage.find_by(parent_id: parent_page.id)
|
|
1301 |
pages_by_parent_id = { nil =>[parent_page], parent_page.id => [child_page] }
|
|
1302 |
result = render_page_hierarchy(pages_by_parent_id, nil, :timestamp => true)
|
|
1303 |
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))
|
|
1304 |
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))
|
|
1305 |
end
|
|
1306 |
|
|
1307 |
def test_render_page_hierarchy_when_action_is_export
|
|
1308 |
parent_page = WikiPage.find(1)
|
|
1309 |
child_page = WikiPage.find_by(parent_id: parent_page.id)
|
|
1310 |
pages_by_parent_id = { nil =>[parent_page], parent_page.id => [child_page] }
|
|
1311 |
|
|
1312 |
# Change controller and action using stub
|
|
1313 |
controller.stubs(:controller_name).returns('wiki')
|
|
1314 |
controller.stubs(:action_name).returns("export")
|
|
1315 |
|
|
1316 |
result = render_page_hierarchy(pages_by_parent_id, nil)
|
|
1317 |
assert_select_in result, 'ul.pages-hierarchy li a[href=?]', "##{parent_page.title}"
|
|
1318 |
assert_select_in result, 'ul.pages-hierarchy li ul.pages-hierarchy a[href=?]', "##{child_page.title}"
|
|
1319 |
end
|
|
1320 |
|
1289 |
1321 |
def test_avatar_enabled
|
1290 |
1322 |
tag_for_anonymous_re = %r{src="/images/anonymous.png(\?\d+)?"}
|
1291 |
1323 |
with_settings :gravatar_enabled => '1' do
|