Merged r12971 (#16255).

git-svn-id: http://svn.redmine.org/redmine/branches/2.5-stable@12979 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2014-03-17 08:30:30 +00:00
parent 4aab2ed303
commit c61a6a707f
2 changed files with 10 additions and 3 deletions

View File

@ -104,9 +104,11 @@ class WikiPage < ActiveRecord::Base
end end
def content_for_version(version=nil) def content_for_version(version=nil)
result = content.versions.find_by_version(version.to_i) if version if content
result ||= content result = content.versions.find_by_version(version.to_i) if version
result result ||= content
result
end
end end
def diff(version_to=nil, version_from=nil) def diff(version_to=nil, version_from=nil)

View File

@ -161,6 +161,11 @@ class WikiControllerTest < ActionController::TestCase
assert_template 'edit' assert_template 'edit'
end end
def test_show_specific_version_of_an_unexistent_page_without_edit_right
get :show, :project_id => 1, :id => 'Unexistent page', :version => 1
assert_response 404
end
def test_show_unexistent_page_with_parent_should_preselect_parent def test_show_unexistent_page_with_parent_should_preselect_parent
@request.session[:user_id] = 2 @request.session[:user_id] = 2
get :show, :project_id => 1, :id => 'Unexistent page', :parent => 'Another_page' get :show, :project_id => 1, :id => 'Unexistent page', :parent => 'Another_page'