Fixed that viewing/editing a wiki page without WikiContent raises an error (#14986).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@12220 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2013-10-13 11:19:47 +00:00
parent 94e7df78ca
commit 5f747faa58
3 changed files with 35 additions and 12 deletions
+23
View File
@@ -177,6 +177,16 @@ class WikiControllerTest < ActionController::TestCase
assert_response 302
end
def test_show_page_without_content_should_display_the_edit_form
@request.session[:user_id] = 2
WikiPage.create!(:title => 'NoContent', :wiki => Project.find(1).wiki)
get :show, :project_id => 1, :id => 'NoContent'
assert_response :success
assert_template 'edit'
assert_select 'textarea[name=?]', 'content[text]'
end
def test_create_page
@request.session[:user_id] = 2
assert_difference 'WikiPage.count' do
@@ -412,6 +422,19 @@ class WikiControllerTest < ActionController::TestCase
assert_equal 2, c.version
end
def test_update_page_without_content_should_create_content
@request.session[:user_id] = 2
page = WikiPage.create!(:title => 'NoContent', :wiki => Project.find(1).wiki)
assert_no_difference 'WikiPage.count' do
assert_difference 'WikiContent.count' do
put :update, :project_id => 1, :id => 'NoContent', :content => {:text => 'Some content'}
assert_response 302
end
end
assert_equal 'Some content', page.reload.content.text
end
def test_update_section
@request.session[:user_id] = 2
page = WikiPage.find_by_title('Page_with_sections')