diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2011-03-21 16:55:28 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2011-03-21 16:55:28 +0000 |
commit | 3d551f97e14e772550ca15bfb169645245b8d4e6 (patch) | |
tree | 95e00ca311ccf8be1af3fb8aaa5a6d9a78447a3a /test/functional/wiki_controller_test.rb | |
parent | 3acae2529ef032b07d319f08ff0f990aa7759840 (diff) | |
download | redmine-3d551f97e14e772550ca15bfb169645245b8d4e6.tar.gz redmine-3d551f97e14e772550ca15bfb169645245b8d4e6.zip |
Fixed: Simultaneous wiki updates cause internal error (#7939).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5185 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/wiki_controller_test.rb')
-rw-r--r-- | test/functional/wiki_controller_test.rb | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/functional/wiki_controller_test.rb b/test/functional/wiki_controller_test.rb index 80ed17b61..37cae481e 100644 --- a/test/functional/wiki_controller_test.rb +++ b/test/functional/wiki_controller_test.rb @@ -155,6 +155,42 @@ class WikiControllerTest < ActionController::TestCase assert_tag :tag => 'input', :attributes => {:id => 'content_version', :value => '1'} end + def test_update_stale_page_should_not_raise_an_error + @request.session[:user_id] = 2 + c = Wiki.find(1).find_page('Another_page').content + c.text = 'Previous text' + c.save! + assert_equal 2, c.version + + assert_no_difference 'WikiPage.count' do + assert_no_difference 'WikiContent.count' do + assert_no_difference 'WikiContent::Version.count' do + put :update, :project_id => 1, + :id => 'Another_page', + :content => { + :comments => 'My comments', + :text => 'Text should not be lost', + :version => 1 + } + end + end + end + assert_response :success + assert_template 'edit' + assert_tag :div, + :attributes => { :class => /error/ }, + :content => /Data has been updated by another user/ + assert_tag 'textarea', + :attributes => { :name => 'content[text]' }, + :content => /Text should not be lost/ + assert_tag 'input', + :attributes => { :name => 'content[comments]', :value => 'My comments' } + + c.reload + assert_equal 'Previous text', c.text + assert_equal 2, c.version + end + def test_preview @request.session[:user_id] = 2 xhr :post, :preview, :project_id => 1, :id => 'CookBook_documentation', |