end
@content = @page.content_for_version(params[:version])
if @content.nil?
- if User.current.allowed_to?(:edit_wiki_pages, @project) && editable? && !api_request?
+ if params[:version].blank? && User.current.allowed_to?(:edit_wiki_pages, @project) && editable? && !api_request?
edit
render :action => 'edit'
else
end
def content_for_version(version=nil)
- if content
- result = content.versions.find_by_version(version.to_i) if version
- result ||= content
- result
- end
+ (content && version) ? content.versions.find_by_version(version.to_i) : content
end
def diff(version_to=nil, version_from=nil)
assert_select 'select[name=?] option[value="2"][selected=selected]', 'wiki_page[parent_id]'
end
+ def test_show_unexistent_version_page
+ @request.session[:user_id] = 2
+ get :show, :params => {:project_id => 1, :id => 'CookBook_documentation', :version => 100}
+ assert_response 404
+ end
+
def test_show_should_not_show_history_without_permission
Role.anonymous.remove_permission! :view_wiki_edits
get :show, :params => {:project_id => 1, :id => 'Page with sections', :version => 2}