diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2013-10-13 11:19:47 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2013-10-13 11:19:47 +0000 |
commit | 5f747faa58c0756827bc13276954136451f6bbc2 (patch) | |
tree | 1d59e9fc42694dec6a85ec4b25a20742f625369b /test/functional/wiki_controller_test.rb | |
parent | 94e7df78ca5265b20d97487a5ba8465644d72710 (diff) | |
download | redmine-5f747faa58c0756827bc13276954136451f6bbc2.tar.gz redmine-5f747faa58c0756827bc13276954136451f6bbc2.zip |
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
Diffstat (limited to 'test/functional/wiki_controller_test.rb')
-rw-r--r-- | test/functional/wiki_controller_test.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/functional/wiki_controller_test.rb b/test/functional/wiki_controller_test.rb index 737a29947..6bf93ea4f 100644 --- a/test/functional/wiki_controller_test.rb +++ b/test/functional/wiki_controller_test.rb @@ -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') |