From 093853b56a5e988d1087dbcb5d3b28bfe153c8a5 2010-06-19 22:17:34 From: Eric Davis Date: 2010-06-19 22:17:34 Subject: [PATCH] Added tests for #5533's behavior. Contributed by Gregor Schmidt. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3788 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/test/functional/documents_controller_test.rb b/test/functional/documents_controller_test.rb index 65afc22..a1ce7ea 100644 --- a/test/functional/documents_controller_test.rb +++ b/test/functional/documents_controller_test.rb @@ -47,6 +47,24 @@ class DocumentsControllerTest < ActionController::TestCase :content => 'Technical documentation'} end + def test_index_with_long_description + # adds a long description to the first document + doc = documents(:documents_001) + doc.update_attributes(:description => < 'ecookbook' + assert_response :success + assert_template 'index' + + # should only truncate on new lines to avoid breaking wiki formatting + assert_select '.wiki p', :text => (doc.description.split("\n").first + '...') + assert_select '.wiki p', :text => Regexp.new(Regexp.escape("EndOfLineHere...")) + end + def test_new_with_one_attachment ActionMailer::Base.deliveries.clear Setting.notified_events << 'document_added'